From owner-dev-commits-src-main@freebsd.org Sun Jan 10 21:56:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B2D1C4DB6C8; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DDVzV4gD1z3mYW; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 8E04A2A2D5; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f177.google.com with SMTP id y128so15078038ybf.10; Sun, 10 Jan 2021 13:56:38 -0800 (PST) X-Gm-Message-State: AOAM531kP0W2tOqqs/XLMV7axBEsWs/O0oKpO7iaq2nOIroGx1O8ovf5 ahXfiy4bZPftjJiOmrF4NU3nZFoHPDxFzwjkIGY= X-Google-Smtp-Source: ABdhPJxll85PYCTMRE8xJPh7cpDD23WI+lKyTsUyplrynzFFBva5WpebYaNuhLHERTeoeCbIbpnaUAJFNRdgj1Bd/5c= X-Received: by 2002:a25:76c3:: with SMTP id r186mr22073507ybc.226.1610315798030; Sun, 10 Jan 2021 13:56:38 -0800 (PST) MIME-Version: 1.0 References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> <8EE9AF5A-E74C-470E-B3E5-A347E3367777@freebsd.org> In-Reply-To: <8EE9AF5A-E74C-470E-B3E5-A347E3367777@freebsd.org> From: Mitchell Horne Date: Sun, 10 Jan 2021 17:56:26 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support To: Jessica Clarke Cc: Konstantin Belousov , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:56:38 -0000 On Sun, Jan 10, 2021 at 5:44 PM Jessica Clarke wrote: > > On 10 Jan 2021, at 21:41, Konstantin Belousov wrote: > > On Sun, Jan 10, 2021 at 09:33:16PM +0000, Jessica Clarke wrote: > >> On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: > >>> On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: > >>>> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: > >>>>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > >>>>> index 3c5277452469..77337e977dcc 100644 > >>>>> --- a/sys/dev/cadence/if_cgem.c > >>>>> +++ b/sys/dev/cadence/if_cgem.c > >>>>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); > >>>>> #include > >>>>> #include > >>>>> > >>>>> +#ifdef EXT_RESOURCES > >>>>> +#include > >>>>> +#endif > >>>>> + > >>>>> +#if INTPTR_MAX == INT64_MAX > >>>>> +#define CGEM64 > >>>>> +#endif > >>>> > >>>> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, > >>>> or SIZE_MAX? The former is probably preferable for PAE systems. > >>> > >>> Wouldn't it be spelled as __LP64__ ? > >> > >> It shouldn't be, because the P stands for pointer(s), which we make > >> 128-bit, though in practice for compatibility we have a hack to define > >> it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). > >> Only the integer addresses are 128-bit. > > > > I have no idea about CHERI, I mean how this statement should be handled > > for FreeBSD. > > Well, ideally in a way that works for FreeBSD and CHERI. This one > happens to do that, though it doesn't feel very idiomatic, and a > comparison against SIZE_MAX or BUS_SPACE_MAXADDR would seem more > accurate (depending on the behaviour you want for PAE systems). FreeBSD > *can* use __LP64__ but it causes pain for us downstream so we prefer > people to be more specific in what they mean (i.e., do you care about > the size of the address space or the size of the representation of > pointers). > > Jess > Indeed, the committed version is not very idiomatic. In this case I would think that a comparison like `#if BUS_SPACE_MAXADDR > BUS_SPACE_MAXADDR_32BIT` describes the intent, but I don't see anything like that in the tree already. I do see several occurrences of `#ifdef __LP64__` under sys/dev/.