[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] arm/its: Decode BASER cacheability field before comparing
- To: Mykola Kvach <xakep.amatop@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Fri, 10 Apr 2026 10:07:06 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XR0eXDP3KKu5v7nSYOsLac7/IFD+WKU6tkHsfvJOYOw=; b=AD0tgAN5+4Ad08KbTZeUXCCGO+iVuIatqgc7pZdAjm6zfEPlncWl6xJl6cBScXoGeB4dVLxOG+yOqyAZmftJ97zdkDXwoAXqlMny1j3Ux/7Uurk9omr3bPUmzBwq8xgLJTCs+1n2PI10pAh0tmXlPseeECWhcOOAdBF+iDyECmncOd70OvdZxhbW070UcXfN5qcWUcE6LDI2spSBAXbfZnYG3+wG1FKK5HyhhPMJKr7H0Ljv0Vh674EZyOXSqH+0Vz30LrbCBGF3M28Pl8+ZI4JqRdryEuz3MtRLG0jPrBwJTVbOo5/4kT1ZPKxFv2G1EvGzGu3Lz4F2Dyqwh1fo0Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DOEk2Fp9bY/8/1u6rM5b94pQuLpZ/9T0QjsVtzTEvWlqLJ2W7+aj3smjqwSwlD74XzhjnEhSlaP/BE0252svbLXY+AyQaMBMU5fDpSFoKHe/+bIxthX8ohcZz0wV+R2D9KTtZ1cOHouaFKSorX2se1LL12XpVtOv6XxLu5shkdr92dzV56BoSdH4Ff4EUeeKYPOwtRRbtjcn1M1JCgqJUA/cu1ehphlgE0iZz5q6iIn6smgrZoMNdzRKzvdnGN/84DdBh24olezk222rYXpT5/SRSvBLknWPJEYOaZXQJ94Y5aC6takEpt7F/CO8nV/Lh1rgHAFf3C4246Ctt1S09Q==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Mykyta Poturai <mykyta_poturai@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Fri, 10 Apr 2026 09:07:20 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 10/04/2026 8:08 am, Mykola Kvach wrote:
> Hi Jan,
>
> Thank you for the review.
>
> On Fri, Apr 10, 2026 at 9:40 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 10.04.2026 08:09, Mykola Kvach wrote:
>>> --- a/xen/arch/arm/gic-v3-its.c
>>> +++ b/xen/arch/arm/gic-v3-its.c
>>> @@ -496,7 +496,8 @@ retry:
>>> }
>>> attr = regc & BASER_ATTR_MASK;
>>> }
>>> - if ( (regc & GITS_BASER_INNER_CACHEABILITY_MASK) <= GIC_BASER_CACHE_nC
>>> )
>>> + if ( ((regc & GITS_BASER_INNER_CACHEABILITY_MASK) >>
>>> + GITS_BASER_INNER_CACHEABILITY_SHIFT) <= GIC_BASER_CACHE_nC )
>> Are you aware of MASK_EXTR()? This is one of the cases that we have it for.
>> Really all *_SHIFT constants should be purged, as they can be calculated
>> from their *_MASK counterparts (leveraging MASK_{EXTR,INSR}() to keep the
>> code readable).
> I wasn't aware of this macro, thanks. I will take a look.
As a general rule of thumb, where you've got a _MASK/_SHIFT pair, you
should be using MASK_INSR/EXTR and delete the shift constant.
It is is ~half the code (visually), and removes an entire class of
errors (mismatched constants).
~Andrew
|