From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdak7-0000tV-VI for qemu-devel@nongnu.org; Thu, 12 Jul 2018 08:30:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdak6-00045W-N0 for qemu-devel@nongnu.org; Thu, 12 Jul 2018 08:30:43 -0400 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:46010) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fdak6-00044w-Gq for qemu-devel@nongnu.org; Thu, 12 Jul 2018 08:30:42 -0400 Received: by mail-oi0-x242.google.com with SMTP id q11-v6so29847178oic.12 for ; Thu, 12 Jul 2018 05:30:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180629132954.24269-9-luc.michel@greensocs.com> References: <20180629132954.24269-1-luc.michel@greensocs.com> <20180629132954.24269-9-luc.michel@greensocs.com> From: Peter Maydell Date: Thu, 12 Jul 2018 13:30:21 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH v3 08/20] intc/arm_gic: Refactor secure/ns access check in the CPU interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luc Michel Cc: QEMU Developers , qemu-arm , Sai Pavan Boddu , Edgar Iglesias , Mark Burton , Jan Kiszka On 29 June 2018 at 14:29, Luc Michel wrote: > An access to the CPU interface is non-secure if the current GIC instance > implements the security extensions, and the memory access is actually > non-secure. Until then, it was checked with tests such as > if (s->security_extn && !attrs.secure) { ... } > in various places of the CPU interface code. > > With the implementation of the virtualization extensions, those tests > must be updated to take into account whether we are in a vCPU interface > or not. This is because the exposed vCPU interface does not implement > security extensions. > > This commits replaces all those tests with a call to the > gic_cpu_ns_access() function to check if the current access to the CPU > interface is non-secure. This function takes into account whether the > current CPU is a vCPU or not. Thanks -- this approach looks much cleaner. > Note that this function is used only in the (v)CPU interface code path. > The distributor code path is leaved unchanged, as the distributor is not "left" > exposed to vCPUs at all. > > Signed-off-by: Luc Michel > --- Reviewed-by: Peter Maydell thanks -- PMM