From owner-freebsd-arm@freebsd.org Wed Nov 25 02:21:28 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 535ED471B0C for ; Wed, 25 Nov 2020 02:21:28 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cgl4l037pz3sFr; Wed, 25 Nov 2020 02:21:26 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1606270884; s=strato-dkim-0002; d=obsigna.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=M3+otxdt32c+Yi1TkdZq3i4XwDP4t9Rp+BPb1gAG01E=; b=NL90+Ne4fhoeyf92VEg7+7Y2dSsK8QfudduiMW7lf/hS2VTXLsm6+p5MI4+E0/nWUM HsiXq7LKL9A/W2BtNGLRqzb6sPTU9hotRHsw6yU35BSHvZ2+nHl55NWS3Yt/aEmpeFhi 7Xg+OvK8gZLV8OqPJmlszs3Fm994cxVvF9nB/IcF8H3Q/0B83GBCoqiuyJF7Hk5EXDNE ZrK9m1nqep0g6F1ToYzhNYGDvdCtJ6InQQt8I/OAz+bXInoEPWRzkLeheGKpYM8okLnR AxYyDs8lqRKtwLnFeLthPTJrY/6iHCIZpfgAd6U9xwn95mjfWb+RTwq1N+f/LmWpTZ3A MTjw== X-RZG-AUTH: ":O2kGeEG7b/pS1F2rRHW2isrKl4DV03XBEi+I6ZuztdvN9wS3wFGySS4Lw+ldTBio0dVbInGjc9RnD7rYRqs=" X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com by smtp.strato.de (RZmta 47.3.3 DYNA|AUTH) with ESMTPSA id U0af7bwAP2LN52b (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 25 Nov 2020 03:21:23 +0100 (CET) Received: from rolf-mini.obsigna.com (rolf-mini.obsigna.com [192.168.222.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 520941350F91D; Tue, 24 Nov 2020 23:21:19 -0300 (-03) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: User Space GPIO Interrupt programming - GSoC-2018 From: "Dr. Rolf Jansen" In-Reply-To: Date: Tue, 24 Nov 2020 23:21:18 -0300 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <467828F4-E653-415C-9AE3-542274EA1951@obsigna.com> References: <2B01780F-D367-48A3-A827-B479030A496D@obsigna.com> To: Ian Lepore X-Mailer: Apple Mail (2.3445.104.15) X-Rspamd-Queue-Id: 4Cgl4l037pz3sFr X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=obsigna.com header.s=strato-dkim-0002 header.b=NL90+Ne4; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-rj@obsigna.com designates 85.215.255.20 as permitted sender) smtp.mailfrom=freebsd-rj@obsigna.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:85.215.255.0/24]; RWL_MAILSPIKE_GOOD(0.00)[85.215.255.20:from]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[obsigna.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[85.215.255.20:from]; ASN(0.00)[asn:6724, ipnet:85.215.255.0/24, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[obsigna.com:s=strato-dkim-0002]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[obsigna.com]; SPAMHAUS_ZRD(0.00)[85.215.255.20:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[85.215.255.20:from]; FROM_NAME_HAS_TITLE(1.00)[dr]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-arm] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2020 02:21:28 -0000 > Am 24.11.2020 um 17:32 schrieb Ian Lepore : >=20 > On Tue, 2020-11-24 at 17:14 -0300, Dr. Rolf Jansen wrote: >> Hello >>=20 >> Has anything of the GSoC-2018 efforts made it into the current code >> base? >>=20 >>=20 > = https://wiki.freebsd.org/SummerOfCode2018Projects/UserSpaceGPIOinterrupts >>=20 >> I installed the recent 13.0-CURRENT snapshot (2020-11-19) on a >> BeagleBone Black which was one of the implementation targets of said >> project, but when running the test tools, I either see cannot >> read/kevent/poll/aio_read - Operation not supported by device or >> Inappropriate ioctl for device. >>=20 >> Perhaps I need to pull the project=E2=80=99s changes into the kernel = by >> myself. However, before this I would like to ask whether it is worth >> the effort. >>=20 >> Please, can anyone shed some light on this. >>=20 >> Best regards >>=20 >> Rolf >>=20 >=20 > I have had that webpage open (but docked) for literally a year, > eternally hoping that I can find time to get to it and somehow get it > committed, or maybe use it as the basis for something to be committed > (I haven't even looked at it close enough to see if it's = commit-quality=20 > code or what). >=20 > I'm curious: What particular need do you have for userspace gpio > interrupts? What would you like the API to look like (do you like the > things listed at that page, or would you prefer something else)? >=20 > Interrupts is probably not a good name, because it isn't really going > to act like an interrupt does for kernel code. It's really just pin- > change notifications delivered to userland. On the Forums somebody reported already success after patching his = kernel with the GSoC-2018 diff's = https://forums.freebsd.org/threads/user-space-interface-for-gpio-interrupt= s.71005/post-428661 He even provided a patch file, and I simply applied this to the = /base/head sources which I updated right before by svn update. Then I = recompiled the kernel for the BBB, and guess what, it works. For testing, I connected a push button to p8.2 and p8.14, and then on = the command line: # gpioctl -f /dev/gpioc0 -c 26 IN PU # ./gpio_intr_test -f /dev/gpioc0 26 ll Then every time when I push the button I see one line: gpio_intr_test: read() interrupt on pin 26 of /dev/gpioc0 This looks quite promising. I would need to examine this test tool which = is provided on the GSoC-2018 GitHub-repository, and then build the = read() handler into my code.=20 However, for as long as the button is pushed I see also ton's of the = following warning messages in the serial console: gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. gpioc0: Unhandled interrupt on pin 26. ... When I run the test tool in er mode (edge rising), then I see only 2 = warnings for each push in the serial console, but because the button is = not debounced, I see a multitude of event messages by the test tool. The = latter behaviour is actually great, since this means that the interrupts = are handled very quick. Anyway, how would I suppress the warning messages in the serial console? Best regards Rolf