From nobody Sun Feb 8 19:58:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637015788; cv=none; d=zohomail.com; s=zohoarc; b=X/fQQmRzU3ZwN10Arx4F5o8Ghd3wlDNiEESEap9SADgUjnbWK9qLzoBhyvQAHSganADO8vy2IQbdrwoYDVTg5Z6RWFpgTvZAk/OE2CZNDETBC2r6iACyRlB7oMrDZvYum53fqvR11iO7tfCBVvM273uHYXHUbdiAbH2q/YRkgLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637015788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8gClzPd0+2kP2htrjZGgkgP6tGqZUPw4g8JDuUbcWpc=; b=KsRpY+CpaQi78/dUw2zBjcTGVxcMK+fd7ZVxj/3I8HlmHpmT65nlvaigHiN2VcKB0PMwwy1lcys/xn3TKTlRYJZcxJ6j1O5L1Bjshm/H0BG0SEU6MrMdx5Jd+QDV/ClcuwosjtAFjABLsG2lvWWxEQtgcANBkInu4dT0g3hTvaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1637015788376456.1638237522045; Mon, 15 Nov 2021 14:36:28 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-iXoES2uCOHaKKv7cUAIOqA-1; Mon, 15 Nov 2021 17:36:26 -0500 Received: by mail-wm1-f70.google.com with SMTP id k25-20020a05600c1c9900b00332f798ba1dso234375wms.4 for ; Mon, 15 Nov 2021 14:36:26 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id b197sm539935wmb.24.2021.11.15.14.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 14:36:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637015787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8gClzPd0+2kP2htrjZGgkgP6tGqZUPw4g8JDuUbcWpc=; b=SeJ0MPIQmQmeTlLZ26fw9dxOfutjge3Z2aKrxCe134X7uKEZfVVmBJppRGtUlTM2Zi/yvf uIIAZa5yYhYi06nAQQf47zXPNgv2HbXP8VbSRbZT3fMy6LaX9NhQWAd5laxuzfl75ysJH6 pl+NsVQY6d7UsOOY6zz6EVFrKT4oNdY= X-MC-Unique: iXoES2uCOHaKKv7cUAIOqA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8gClzPd0+2kP2htrjZGgkgP6tGqZUPw4g8JDuUbcWpc=; b=tn5KQ3fOSokIBsARQ56BVfbFWZBT+GqtDSVC2rZwPcJTDWmPdoUsHyiuxokHrU23vP SfZevtAkZy6bqgA8iCG4lPhfuSUZ153TAQmHJBtMwkJK4qdxbixRZE/udPBCxUZH0Ny1 P5wTyYtQ77/JlvvhuJVPsgaKf3UZ8g9SPIw/ZGKi1oln1Xj0HcqjBnvANcnuXH8XFq/8 X5FApi/4hR0n1ZCD3l6Gq+jcY3oCR43pEOh0jSZZ7jEj9L1KFe6x30Ze7qKVAB9UZ49x LdsrcHWi/xTsnIvqF98mEg/33mqfIMW/Mljh0ZxDnK4tezogL6A44Z/QXEmF+01BttXt qKVg== X-Gm-Message-State: AOAM531PRz2b0BssiH3DysGR9SUnXUj+usSfngHedaRiClnXq3xe4Cid EcLj2nAIsjkde5gyzDBD3/qJTJ1rQqp2+6CrXL/wqELmKRPWdtEOyx21/MXEEU7szgiq/A+Axgl 9mBZlkuBEk0xhdg== X-Received: by 2002:adf:ef4f:: with SMTP id c15mr3282861wrp.226.1637015785241; Mon, 15 Nov 2021 14:36:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDQIYc/IGwQr0byDchmqjf8igCIi9btwewQONhyppRXWu9+RZ8Zt4xfMghp3GPhppLuQaHAw== X-Received: by 2002:adf:ef4f:: with SMTP id c15mr3282843wrp.226.1637015785054; Mon, 15 Nov 2021 14:36:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Miroslav Rezanina , Shashi Mallela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c Date: Mon, 15 Nov 2021 23:36:18 +0100 Message-Id: <20211115223619.2599282-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211115223619.2599282-1-philmd@redhat.com> References: <20211115223619.2599282-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637015790451100001 gicv3_set_gicv3state() is used by arm_gicv3_common.c in arm_gicv3_common_realize(). Since we want to restrict arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() to a new file. Add this file to the meson 'specific' source set, since it needs access to "cpu.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/intc/arm_gicv3_cpuif.c | 10 +--------- hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ hw/intc/meson.build | 1 + 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 hw/intc/arm_gicv3_cpuif_common.c diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 3fe5de8ad7d..5e539e3b5ef 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -1,5 +1,5 @@ /* - * ARM Generic Interrupt Controller v3 + * ARM Generic Interrupt Controller v3 (emulation) * * Copyright (c) 2016 Linaro Limited * Written by Peter Maydell @@ -21,14 +21,6 @@ #include "hw/irq.h" #include "cpu.h" =20 -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) -{ - ARMCPU *arm_cpu =3D ARM_CPU(cpu); - CPUARMState *env =3D &arm_cpu->env; - - env->gicv3state =3D (void *)s; -}; - static GICv3CPUState *icc_cs_from_env(CPUARMState *env) { return env->gicv3state; diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_com= mon.c new file mode 100644 index 00000000000..ff1239f65db --- /dev/null +++ b/hw/intc/arm_gicv3_cpuif_common.c @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * ARM Generic Interrupt Controller v3 + * + * Copyright (c) 2016 Linaro Limited + * Written by Peter Maydell + * + * This code is licensed under the GPL, version 2 or (at your option) + * any later version. + */ + +#include "qemu/osdep.h" +#include "gicv3_internal.h" +#include "cpu.h" + +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) +{ + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + CPUARMState *env =3D &arm_cpu->env; + + env->gicv3state =3D (void *)s; +}; diff --git a/hw/intc/meson.build b/hw/intc/meson.build index c89d2ca180e..11352806db2 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -25,6 +25,7 @@ =20 specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinne= r-a10-pic.c')) specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common= .c')) +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_co= mmon.c')) specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'= )) specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'= )) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: f= iles('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) --=20 2.31.1 From nobody Sun Feb 8 19:58:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637015793; cv=none; d=zohomail.com; s=zohoarc; b=YIrF8QxCyo82M3vKA9pY2ZjEF1GFmt93RqtPewlLIhc+SGDMvhghZtFk/+lmApkurQ9tIJA7HOCjqAafsBgD3Y2TiRkY2h1S9kLGZK+4g1fn4Wq477wpUb62S13DhxI62ZSFA79NvJPf6UrXiYUidW3Ae2UmRsiX48vvXg8hh7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637015793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=A6cf7aB4+QDSTk3uAaJrNRUpmepplRJF45y+7KCnkr4=; b=ER88e1pdCQ1rSMDIIvN3F0X1O9WepXou/Qdwm34MuxPeH0ZZVmZTiRwrN+n8QHl5FCPhq+/sw4W9iwENhB03/ulUIjsK+PJJtcrD4wyvKCIz7njQL0jNsIaJhs1RVCczImW5y3p229gyke7KHNok2aduRgtBArmtaJpvubW+YIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1637015793176537.6397918028973; Mon, 15 Nov 2021 14:36:33 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-Pf2LtC92MvymJZ1TDSCbYA-1; Mon, 15 Nov 2021 17:36:30 -0500 Received: by mail-wm1-f69.google.com with SMTP id 205-20020a1c00d6000000b003335d1384f1so237558wma.3 for ; Mon, 15 Nov 2021 14:36:30 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id i17sm627846wmq.48.2021.11.15.14.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 14:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637015792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A6cf7aB4+QDSTk3uAaJrNRUpmepplRJF45y+7KCnkr4=; b=YDmQpI1PSRSpN9g1tlw29p3t5ANFweP06FNo938qeJY0SBy6cVzYjkHDfMx8hz8DUKjHaB 5m6lmQhfdX8KHdEDQd/7KHlW2xBc/Qnzzp9IDWj7yOfFDgLHFLSr9q52F4R8t4XV4Bwoxf jYhbDPwXlOIPfCoQkCCCYXtrK4SlgTQ= X-MC-Unique: Pf2LtC92MvymJZ1TDSCbYA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A6cf7aB4+QDSTk3uAaJrNRUpmepplRJF45y+7KCnkr4=; b=a5PZFGwd4BAGMcRSOkIvGxVgeDHtkydzWYqd4YwhgFSMB01rlPtCJSqHvpQWb6ZRdU Hcme9LII64zVSxup4QCE3CyYzcuBHOPIBPbO+Y8cKNjWR+yUFaS5U8Vyg0TcTc3SS6dM ixT9vLgqn9WP7B+GGv5d83KOSO1gZkhZveMytEOvy/bvy4lCt3Qy7qMHkAsg6Xv1koaH ur4BjFTc2GDdqr8qPBxVrBUarBfW6UFU927z+UQO/IZJYItzx7j2jeBerpj8CEcc6GbD 0coPO7ukr35FzrDF8rqqhmpLsnbfdGD3KBUnlVsV/CVC08yWKZq2UYrAAPb+0sL2wrkj pVMA== X-Gm-Message-State: AOAM531fS4HiKyTeRjghYAGMqAAJj0wDP0QmDY2GMXm/O6WSqBFzJqdG 8frdl8O+Ibu86XGs5nCvRikV93wFzoXLjQ7Dmd1Ekhv6B+EAugk1uF43cQ+1TDOHRbZY9mxPnmQ hN88Enj47GVwl+A== X-Received: by 2002:a05:6000:143:: with SMTP id r3mr3347011wrx.236.1637015789623; Mon, 15 Nov 2021 14:36:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxp0THh9QS5GhBlJIpP31oH7Lqvfk+SrHdf+46T7qGWHnOiBhQYHEg/b6dNN/bTl4AZ+fKEwA== X-Received: by 2002:a05:6000:143:: with SMTP id r3mr3346989wrx.236.1637015789471; Mon, 15 Nov 2021 14:36:29 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Miroslav Rezanina , Shashi Mallela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.2? 2/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Date: Mon, 15 Nov 2021 23:36:19 +0100 Message-Id: <20211115223619.2599282-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211115223619.2599282-1-philmd@redhat.com> References: <20211115223619.2599282-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637015795253100001 The TYPE_ARM_GICV3 device is an emulated one. When using KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device (which uses in-kernel support). When using --with-devices-FOO, it is possible to build a binary with a specific set of devices. When this binary is restricted to KVM accelerator, the TYPE_ARM_GICV3 device is irrelevant, and it is desirable to remove it from the binary. Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector which select the files required to have the TYPE_ARM_GICV3 device, but also allowing to de-select this device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/intc/arm_gicv3.c | 2 +- hw/intc/Kconfig | 5 +++++ hw/intc/meson.build | 10 ++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c index c6282984b1e..76950c6f724 100644 --- a/hw/intc/arm_gicv3.c +++ b/hw/intc/arm_gicv3.c @@ -1,5 +1,5 @@ /* - * ARM Generic Interrupt Controller v3 + * ARM Generic Interrupt Controller v3 (emulation) * * Copyright (c) 2015 Huawei. * Copyright (c) 2016 Linaro Limited diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 78aed93c454..010ded7eae0 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -25,6 +25,11 @@ config APIC select MSI_NONBROKEN select I8259 =20 +config ARM_GIC_TCG + bool + default y + depends on ARM_GIC && TCG + config ARM_GIC_KVM bool default y diff --git a/hw/intc/meson.build b/hw/intc/meson.build index 11352806db2..70080bc161c 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -3,12 +3,14 @@ 'arm_gic.c', 'arm_gic_common.c', 'arm_gicv2m.c', - 'arm_gicv3.c', 'arm_gicv3_common.c', - 'arm_gicv3_dist.c', 'arm_gicv3_its_common.c', - 'arm_gicv3_redist.c', +)) +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( + 'arm_gicv3.c', + 'arm_gicv3_dist.c', 'arm_gicv3_its.c', + 'arm_gicv3_redist.c', )) softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c= ')) @@ -26,7 +28,7 @@ specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinne= r-a10-pic.c')) specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common= .c')) specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_co= mmon.c')) -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'= )) +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpui= f.c')) specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'= )) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: f= iles('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) --=20 2.31.1