Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4359650pxf; Tue, 30 Mar 2021 06:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA3Hf9+HD2/mcJ/D7J53nlk5n/ewTpH2FyAqAPKauIbZ1jYSZxDCXDlawQ/yoZFVyi7nTU X-Received: by 2002:a17:906:af91:: with SMTP id mj17mr32254942ejb.230.1617109714556; Tue, 30 Mar 2021 06:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617109714; cv=none; d=google.com; s=arc-20160816; b=plwumWAUSHNy/3BN0uowNcRxh+RlbqWEEyzFbYR3gFoChz59pYsIYnSHmEI1+IXVqS G3l2NxAF2yQHh3qkTejFGpkFsxc5o3dEVzzPMo+SvICFpKRlZlJG5HrmLKLT8f893/g/ NrCf6N9LECkwf2ZC5WkjmSXmx3l3FlMBuSzTXg+hZ7/sEuvGK0jKajKKsIQFTFMO7VQM VY5IikluyDqv4bua1mx3F/dbWYOCi8uwQYIsUaif7PIBJ5g+sisniPWRsbTL5i6Qm1Rw 4WEF+8FV57qoAhBxONJ2WBkiuzS79wpwf19G+cats8WgW5hYhrrU6O0gp60Is83u3FaO 6xNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=zidasJklCTAbziCEvR05/glWL85MLAgY81p2TIvxUNs=; b=yNepenaqXc03+FIGIEUZChkWAUpFKpASdb3DFLkCCm4RdJJMF5FUeVxDaRl38C0X1X bApacCeyMGWN5NrW3tLpVRFBbhbMgHk8JtZ5Nf4y4qT0kfY1+Qvs0xAh38tBzc7097Ox XTa+JKCvEzqFkYYsX7t2zHvPSkFQJlL0NlRiN5VD8VpvtZ/9gElBzLcVS6ZovH5JRdEb 9nXUFqy27Ly11PkcwHCE+2LWjI5DFLdb6uPw4wSEVjN6dLCLeoCmqyN5asvFoZH1EAJy qcHKZ0iK3n/n2TSqEBEmiV9BIQ2ILCXpOf2ui3rNhArxl0VPN3kG5hx2ex9Z/BbEtFAf blug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy14si15093901ejb.533.2021.03.30.06.08.11; Tue, 30 Mar 2021 06:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbhC3NGy (ORCPT + 99 others); Tue, 30 Mar 2021 09:06:54 -0400 Received: from foss.arm.com ([217.140.110.172]:60836 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhC3NGp (ORCPT ); Tue, 30 Mar 2021 09:06:45 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D47F131B; Tue, 30 Mar 2021 06:06:44 -0700 (PDT) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B7A883F694; Tue, 30 Mar 2021 06:06:43 -0700 (PDT) Date: Tue, 30 Mar 2021 14:06:37 +0100 From: Lorenzo Pieralisi To: Marc Zyngier Cc: Lecopzer Chen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, lecopzer@gmail.com, yj.chiang@mediatek.com, Julien Thierry Subject: Re: [PATCH] irqchip/gic-v3: Fix IPRIORITYR can't perform byte operations in GIC-600 Message-ID: <20210330130637.GA26263@lpieralisi> References: <20210330100619.24747-1-lecopzer.chen@mediatek.com> <87o8f1q6c6.wl-maz@kernel.org> <20210330110546.GA24881@lpieralisi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330110546.GA24881@lpieralisi> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 12:05:46PM +0100, Lorenzo Pieralisi wrote: > On Tue, Mar 30, 2021 at 11:33:13AM +0100, Marc Zyngier wrote: > > [+Lorenzo, +Julien on an actual email address] > > > > On Tue, 30 Mar 2021 11:06:19 +0100, > > Lecopzer Chen wrote: > > > > > > When pseudo-NMI enabled, register_nmi() set priority of specific IRQ > > > by byte ops, and this doesn't work in GIC-600. > > > > > > We have asked ARM Support [1]: > > > > Please refer to following description in > > > > "2.1.2 Distributor ACE-Lite slave interface" of GIC-600 TRM for > > > > the GIC600 ACE-lite slave interface supported sizes: > > > > "The GIC-600 only accepts single beat accesses of the sizes for > > > > each register that are shown in the Programmers model, > > > > see Chapter 4 Programmer's model on page 4-102. > > > > All other accesses are rejected and given either an > > > > OKAY or SLVERR response that is based on the GICT_ERR0CTLR.UE bit.". > > > > > > Thus the register needs to be written by double word operation and > > > the step will be: read 32bit, set byte and write it back. > > > > > > [1] https://services.arm.com/support/s/case/5003t00001L4Pba > > > > You do realise that this link: > > > > - is unusable for most people as it is behind a registration interface > > - discloses confidential information to other people > > > > I strongly suggest you stop posting such links. > > > > > > > > Signed-off-by: Lecopzer Chen > > > --- > > > drivers/irqchip/irq-gic-v3.c | 13 ++++++++++++- > > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > > > index eb0ee356a629..cfc5a6ad30dc 100644 > > > --- a/drivers/irqchip/irq-gic-v3.c > > > +++ b/drivers/irqchip/irq-gic-v3.c > > > @@ -440,10 +440,21 @@ static void gic_irq_set_prio(struct irq_data *d, u8 prio) > > > { > > > void __iomem *base = gic_dist_base(d); > > > u32 offset, index; > > > + u32 val, prio_offset_mask, prio_offset_shift; > > > > > > offset = convert_offset_index(d, GICD_IPRIORITYR, &index); > > > > > > - writeb_relaxed(prio, base + offset + index); > > > + /* > > > + * GIC-600 memory mapping register doesn't support byte opteration, > > > + * thus read 32-bits from register, set bytes and wtire back to it. > > > + */ > > > + prio_offset_shift = (index & 0x3) * 8; > > > + prio_offset_mask = GENMASK(prio_offset_shift + 7, prio_offset_shift); > > > + index &= ~0x3; > > > + val = readl_relaxed(base + offset + index); > > > + val &= ~prio_offset_mask; > > > + val |= prio << prio_offset_shift; > > > + writel_relaxed(val, base + offset + index); > > > } > > > > > > static u32 gic_get_ppi_index(struct irq_data *d) > > > > From the architecture spec: > > > > > > 11.1.3 GIC memory-mapped register access > > > > In any system, access to the following registers must be supported: > > > > [...] > > * Byte accesses to: > > - GICD_IPRIORITYR. > > - GICD_ITARGETSR. > > - GICD_SPENDSGIR. > > - GICD_CPENDSGIR. > > - GICR_IPRIORITYR. > > > > > > So if GIC600 doesn't follow this architectural requirement, this is a > > HW erratum, and I want an actual description of the HW issue together > > with an erratum number. > > > > Lorenzo, can you please investigate on your side? > > Sure - I will look into it and report back. Checked - I don't think this patch is needed so it should be dropped and a follow-up discussion can continue in the relevant/appropriate forum - if there is anything left to discuss. Thanks, Lorenzo