Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4265123pxf; Tue, 30 Mar 2021 03:35:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtTiQsDnaOR2ouwwb9C0u4YJ8pd18oMpbGd2lQffi0srrnm6tPbuSY1znjwSLCxO5B3lLg X-Received: by 2002:a17:906:1fd2:: with SMTP id e18mr33699613ejt.49.1617100524429; Tue, 30 Mar 2021 03:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617100524; cv=none; d=google.com; s=arc-20160816; b=s96k1hdoCVpoNwCi7Y4mHets4nQmJvypnSl5OX3UocwgaBY2XOX4vYznnpZLUZOn0n Y4GY8cwOczDbbEnSghuZvoZd1VKXlacRe+uVR3i4Oz0Nb0sjYCWAOhfdkO5PImE0P/vF dtal1dfXANn7a1soS/ZmEVyvoqYHPaX+gjaA2vfQDMHNoaBU/RHLpnpFm5rmvnaQpQqS eF1ZD1bp3hNy7YZPDs8exuHb0+2HorrC145C41UslhRtKniOCLeXFMzuSTEsjj7E2b7A 0zvcOp8C8Nwyy4yoXf6auOJ14QM/y374+49X77APRfUkc+J9FIaLkES27t5yU6gk5ZPB /NkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=sbLzlp1LwSW2dks+R9XS8RSC6D0ArAlNfwLJ+AIYqcg=; b=bgabzcMeN68Rkmrd4lN2+WCct21qRQD59CtRrShl1fAHr9l2+9MhesPUb9XsCUmSh4 K79cCCkyWgzMTAOvqvFH56qMK3nhe6E59nF+hLnY4tbl7I7upcPRKXqWsZG2guWprEzW zAU4zRUicU/uYAcmY/jdAygsG9HAFi+qCAPmyeV75tLjzVSHLf8gwZKX6knSw6MEflFO BUy6NtaI9WaXhIy5oH3+HRA5s/csqs1WTNT22A/KFGHUdCtBq3G5254uoEApmsOiuczi vwfBRKD8aY/qz1myQgsYwxGO3sm+ZwKudmad8QiRI9+ZvxbUraQn+oW8OFvkq8SmJ/at sW6w== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x16si14409507edd.234.2021.03.30.03.35.01; Tue, 30 Mar 2021 03:35:24 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbhC3Kdr convert rfc822-to-8bit (ORCPT + 99 others); Tue, 30 Mar 2021 06:33:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:44384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbhC3KdS (ORCPT ); Tue, 30 Mar 2021 06:33:18 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5545619AB; Tue, 30 Mar 2021 10:33:16 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lRBgQ-004eeQ-Js; Tue, 30 Mar 2021 11:33:14 +0100 Date: Tue, 30 Mar 2021 11:33:13 +0100 Message-ID: <87o8f1q6c6.wl-maz@kernel.org> From: Marc Zyngier To: Lecopzer Chen Cc: , , , , , Lorenzo Pieralisi , Julien Thierry Subject: Re: [PATCH] irqchip/gic-v3: Fix IPRIORITYR can't perform byte operations in GIC-600 In-Reply-To: <20210330100619.24747-1-lecopzer.chen@mediatek.com> References: <20210330100619.24747-1-lecopzer.chen@mediatek.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: lecopzer.chen@mediatek.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, lecopzer@gmail.com, yj.chiang@mediatek.com, lorenzo.pieralisi@arm.com, julien.thierry.kdev@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+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? Thanks, M. -- Without deviation from the norm, progress is not possible.