From nobody Mon Feb 9 06:31:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1635433532; cv=none; d=zohomail.com; s=zohoarc; b=GgL4qdnBHCJMnSyXYuhenyA2b6Q9G5d81KlHVtS4OsBaAl+P7ojlNC/GyjWBpTyE1+kGsueaWWmTEvag9gwGrbaE2e1Uj1yx1lD24f4xiPQFR7dtZJqtT5OKwey3MaZlu5AYVx7/pzebIbhQ2jyuuuYbGMAkVI1Kg/De68hdhIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635433532; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=64kbEvhgsvTtmcrJ2XOWOXD5KZT50cBaqVp/eA5mjE8=; b=ThRQY9TdRGgbYlATaPtyyLVxNY88d91G0K4FF97qh9ot2CAF+vE5smucPL5nWJbYJlhX3N7fuXsZWobfswvyyKmW9f9ow3pLjTSymEWxsheHsrw+WUXKHhYItRgYfBih+sKFjh0Eh5OgUTsDB+RKquloYynlXactyC4zp3oyJ7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635433532920771.737777479064; Thu, 28 Oct 2021 08:05:32 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-aQENOABbPjmP8Wjlzk4QPQ-1; Thu, 28 Oct 2021 11:05:30 -0400 Received: by mail-wr1-f71.google.com with SMTP id j12-20020adf910c000000b0015e4260febdso2220642wrj.20 for ; Thu, 28 Oct 2021 08:05:30 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id j10sm3176917wrx.94.2021.10.28.08.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 08:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635433531; 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=64kbEvhgsvTtmcrJ2XOWOXD5KZT50cBaqVp/eA5mjE8=; b=K+PiXpGNcclgbODftweqjpYCyom6jVzyLk55yr2xl7HqDcjUyLXFPmd+75RgB+8XxVfxKC P+5s/+ddDGxkno3WyVjiSsaMWIm1WoJuRd9jsvjD74a3SjdpKowUxDfYca7MxQ4tjI3e8w d5+I5hbWYmMDuQnVelj5EdnP1CMNqKo= X-MC-Unique: aQENOABbPjmP8Wjlzk4QPQ-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=64kbEvhgsvTtmcrJ2XOWOXD5KZT50cBaqVp/eA5mjE8=; b=nlIeWlUDJIUZ2jLofKwrQOjCrBwS4nGjmENwz0b3e8WBdWN4vmHVzjQr2JlpH4afU6 Oxthd/p3I0SVcDMXSZvpTaWClOOJsvrx5zz7CJndMSHBl3urdCykV0IOaGeeS+UFqZ1c vSvdtOs5PG2BlArhAwTbs3xvRRcoyjmqa8yWpW0AYKOL6oxd65Knj8aB+xRZ1kSA63q+ +DBk3BfrUBDua9deKedFAEak18SMoWpEzkoLSp/28sRwR4jNbiYtyKTys9R4Njy/FLLu EFZBW6wh0SicCZK3BEDE+NwnkbDU40wf0yBc3EGDdRsFN8MT2FJjh63CkbzPj8Qj2P/w Z1ew== X-Gm-Message-State: AOAM5306DJCyPSElHJAZ46eB/SwThcazC2konfO9SDpklAmBbpWtyb0H NwzvgrHPs2ED03/ypz+V5lRzuwvQ1CdxunvtFKhs52mm/FZjbsjUKiXmSsKm7eUULcbYlNKyjBR jYrUYqqI+GIERGQ== X-Received: by 2002:a05:600c:3581:: with SMTP id p1mr12883769wmq.34.1635433529379; Thu, 28 Oct 2021 08:05:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9cNv+UTrZZcL1WQuz+EcitzSKpMp9UvkyFxL9PUhH9XTloF6Tsz5tBixL62aVHvKKaiXXmQ== X-Received: by 2002:a05:600c:3581:: with SMTP id p1mr12883730wmq.34.1635433529134; Thu, 28 Oct 2021 08:05:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Yanan Wang , Eduardo Habkost , Igor Mammedov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/4] hw/core: Restrict sysemu specific files Date: Thu, 28 Oct 2021 17:05:18 +0200 Message-Id: <20211028150521.1973821-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211028150521.1973821-1-philmd@redhat.com> References: <20211028150521.1973821-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: 1635433533879100003 All these files don't make sense for tools and user emulation, restrict them to system emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eduardo Habkost Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- hw/core/meson.build | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/core/meson.build b/hw/core/meson.build index 18f44fb7c24..a829cc4245b 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -14,15 +14,15 @@ ) =20 common_ss.add(files('cpu-common.c')) -common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c')) -common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: files('generic-loade= r.c')) -common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true: files('guest-lo= ader.c')) -common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c')) -common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('platform-bus.c'= )) -common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c')) -common_ss.add(when: 'CONFIG_REGISTER', if_true: files('register.c')) -common_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c')) -common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) +softmmu_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c')) +softmmu_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: files('generic-load= er.c')) +softmmu_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true: files('guest-l= oader.c')) +softmmu_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c')) +softmmu_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('platform-bus.c= ')) +softmmu_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c')) +softmmu_ss.add(when: 'CONFIG_REGISTER', if_true: files('register.c')) +softmmu_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c')) +softmmu_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) =20 softmmu_ss.add(files( 'cpu-sysemu.c', --=20 2.31.1 From nobody Mon Feb 9 06:31:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1635433538; cv=none; d=zohomail.com; s=zohoarc; b=nbCYdcqyO2WpHvTI+3y5+Yqdw2gxhlzSfOOWhrgvmQMI6lccjAALM2VYC09vgA900U5Z4mA6QJS3jWe1uWtsJz5QCwJbUmn3ryh8HIjHn3evHgiUAH7dmzpvTJS+XIxZU6Dkc1pEza3T8q0YIYOOOszOM+lEX+FCwgXBNNiOVtk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635433538; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=bgN4VtmbpKha1U3dbSRWObWfSCBYh9C5Ynebd+aNbtU=; b=EsRvwfX7yqbroY9i06XgZLZDy/GssA0XW43FEHKk9ghDq4Wru3uWkCpFwaWMEk21zYmjNXbUEkomzj0/OvBr3e+CoGHz0hMbXFrZJyfOk7r/z1VIohbhKfmR3djnmigJYhHQHFfoMGKvApdLuIWHp+x560tO9dSH9bP57xNbKoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635433538592831.5681915690261; Thu, 28 Oct 2021 08:05:38 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-eIgDGdtmNeSwNwxjjUWjsA-1; Thu, 28 Oct 2021 11:05:36 -0400 Received: by mail-wr1-f70.google.com with SMTP id i2-20020adfefc2000000b001709de9b770so2235204wrp.16 for ; Thu, 28 Oct 2021 08:05:36 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id l8sm4265906wry.43.2021.10.28.08.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 08:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635433537; 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=bgN4VtmbpKha1U3dbSRWObWfSCBYh9C5Ynebd+aNbtU=; b=HaH51swt1ODVTWWKnsEH2naSiT2Nl1QnPf2/Dv294+OqrNtBkXmN+vnYFEyQL3CTzoiBRE hv+IwQPHlb2xDLRIffSLxUpABkC6bWKj7EYhrrDf/xNGJOBsm9SiZ4ZGsaL2sC8O61D8nV ynK/lxz6ecFJkiEGn4EfNZY39lB0h0g= X-MC-Unique: eIgDGdtmNeSwNwxjjUWjsA-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=bgN4VtmbpKha1U3dbSRWObWfSCBYh9C5Ynebd+aNbtU=; b=ZiR0n/Otv+W47IBM5xa3ION9pyuSo1Cs77JtTAuTTOSl4oKzlnfSInlZBlkMOeRbtJ IUfP5KQc7BG0Dr3Hyn7nH41g2Os9h+mED7dxkRlsSZfIbIBxWt5MaQiUhoWNm7NH/TT2 xy9UxH+O+jFSlT3iWzBT702lwUntjoHPWGAAJgD5Wy72vFZF6yW3oUn+aZPZw/3P4Wbe UhzLhruP67zUQeXoUHv7uFpcz7OZgbbs4YU9WEkYVJDheVgmiCjW6U7ZuRUT+lQxrCEp wWC5qwt9Fh5ai/etuC0jbtQtP2YnFf8Xyo05qWj6yTUy0gYvy6tkkcMV99CGnGTOrDp7 mPig== X-Gm-Message-State: AOAM532qv3fnpLY9AKDRliIE03+Uh7zRPUZsLWdDgeskjODsXR5x4KBt /xmYQ0ZdBb9GDBtWRB2xrGQU/Cy8GZPzuocSqXWIEdS6ZinpM4BSp1tGKdaIttzrsFuANTC0/MJ 6QgPkoB3fGQaEwA== X-Received: by 2002:a05:600c:4ca9:: with SMTP id g41mr5044386wmp.139.1635433535256; Thu, 28 Oct 2021 08:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBY6nM4w+6cGO0BZPqNwsdGY74MpF1H5H5JYsXRWlFcytsIqWLK8OMU19gFFGgxqk/oSM8Fg== X-Received: by 2002:a05:600c:4ca9:: with SMTP id g41mr5044197wmp.139.1635433533600; Thu, 28 Oct 2021 08:05:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Yanan Wang , Eduardo Habkost , Igor Mammedov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/4] hw/core: Declare meson source set Date: Thu, 28 Oct 2021 17:05:19 +0200 Message-Id: <20211028150521.1973821-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211028150521.1973821-1-philmd@redhat.com> References: <20211028150521.1973821-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: 1635433539112100001 As we want to be able to conditionally add files to the hw/core file list, use a source set. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eduardo Habkost Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- meson.build | 4 +++- hw/core/meson.build | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 2c5b53cbe2e..2eb76c187c3 100644 --- a/meson.build +++ b/meson.build @@ -2365,6 +2365,7 @@ chardev_ss =3D ss.source_set() common_ss =3D ss.source_set() crypto_ss =3D ss.source_set() +hwcore_ss =3D ss.source_set() io_ss =3D ss.source_set() linux_user_ss =3D ss.source_set() qmp_ss =3D ss.source_set() @@ -2805,7 +2806,8 @@ =20 chardev =3D declare_dependency(link_whole: libchardev) =20 -libhwcore =3D static_library('hwcore', sources: hwcore_files + genh, +hwcore_ss =3D hwcore_ss.apply(config_host, strict: false) +libhwcore =3D static_library('hwcore', sources: hwcore_ss.sources() + genh, name_suffix: 'fa', build_by_default: false) hwcore =3D declare_dependency(link_whole: libhwcore) diff --git a/hw/core/meson.build b/hw/core/meson.build index a829cc4245b..4d04069f85f 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -1,5 +1,5 @@ # core qdev-related obj files, also used by *-user and unit tests -hwcore_files =3D files( +hwcore_ss.add(files( 'bus.c', 'hotplug.c', 'qdev-properties.c', @@ -11,7 +11,7 @@ 'irq.c', 'clock.c', 'qdev-clock.c', -) +)) =20 common_ss.add(files('cpu-common.c')) softmmu_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c')) --=20 2.31.1 From nobody Mon Feb 9 06:31:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1635433541; cv=none; d=zohomail.com; s=zohoarc; b=hPOKruSo/ipVBSj8xjtPEXxAjHm60oq1FXxAYvBwIVAMBFOXGwcBhfZ8VYKKuvtcqE3Y4PyVvR7ekgUQJYp0QTUnlLylfw408LtKus/ulVoDWAzcSUWTxzxpIxQBTyl28fS45rwoZlElw8ZafFTjuFu66+715h1ei6WOUlSKomg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635433541; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=BP2YG+UwU9At2GQjrOrvf7QoxC3M4wZVtXRCu8IsEeY=; b=f1GRgZa6gB1TS2P+fmHydwGyEV+ny3ITEtIh+cDofzNhMBVc6gI5YaDRE9Uj2cdKWdBs4Xwr5OoKiquWwiMPn7icB8s/EAUKOvsdytO2e5yKtBeiQGfa7llDERAkTOAv7OFbc7pmXSfliYBOR1qiwXIoLSGTCHPrIlYDik43Zbs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635433541925710.955711485754; Thu, 28 Oct 2021 08:05:41 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-gts5K2YIMsKlqwjFtCa5Zw-1; Thu, 28 Oct 2021 11:05:39 -0400 Received: by mail-wr1-f70.google.com with SMTP id c6-20020adfe706000000b00168acf1bcd5so2231540wrm.5 for ; Thu, 28 Oct 2021 08:05:39 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id e9sm3252978wrn.2.2021.10.28.08.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 08:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635433540; 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=BP2YG+UwU9At2GQjrOrvf7QoxC3M4wZVtXRCu8IsEeY=; b=gUd5LyZpjKMlpqtcPWjcfx40GW6lRlDtzHX+mZmi+7Sbr9J073tYy3CLfMZpjEDu7BlMdh kobzsnRD4Uo5CD2kDBa0OWOSy6PhzlpX7N2ty4GDV7oQr56xZWs4q57Dpih8r9GC4zUTyV qnVaqjco4Y/g12xpu1EPm4xVgskyQmw= X-MC-Unique: gts5K2YIMsKlqwjFtCa5Zw-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=BP2YG+UwU9At2GQjrOrvf7QoxC3M4wZVtXRCu8IsEeY=; b=OomNW1W7eHy5ecDL1fNUzgEQQ5oVLsjenwlsrH3Nr1DNQnrbcbJrn4pkQqPHGVX43x y701UCHVaGzOxkfyD6cizkyiVzsAZ6mF9XJM2Ueo+JV83FPoioJ1XSfc42aOfRmU05ls tN3YCjBxslXOF7o5lMXr3kvrESsqt7yxKC5dpOk8el9jlsDHJYP6vdjBtKxwyxQ33XON 21DlSgQtsIWhbIgNoyD2v5qAZmkJ7tHf2ZYGIqQQYL/+h8UISqS43yw2MHKDJWQ23Aqv RAIoSAj74Qpy/qxE1KfSJqtxGyHj8L9ISpMLDFwSDQXyWlCwcIppkESvZyHYqNnIj5x8 FePQ== X-Gm-Message-State: AOAM530QXnKe6tdeTaynQKBBSME5PNnPmZBFnVaIJzHdnvK1XoYJhD1Q HEha0z7JyQoBVzMrF1G5783O07l37fJP4yehQvc7+lKE3vm6XsFHqsuhBP8f9T1MSXv1Rj/2vuB KPdqugrukbwpQrg== X-Received: by 2002:adf:959a:: with SMTP id p26mr6332323wrp.342.1635433538230; Thu, 28 Oct 2021 08:05:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfdaIODQY29LG0UaL6aZJ/CT3C9MkLEbsk0ssVIEjXTS5y0fcCVo0BKxF3WM4rkYpS0feH1Q== X-Received: by 2002:adf:959a:: with SMTP id p26mr6332298wrp.342.1635433538083; Thu, 28 Oct 2021 08:05:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Yanan Wang , Eduardo Habkost , Igor Mammedov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/4] hw/core: Extract hotplug-related functions to qdev-hotplug.c Date: Thu, 28 Oct 2021 17:05:20 +0200 Message-Id: <20211028150521.1973821-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211028150521.1973821-1-philmd@redhat.com> References: <20211028150521.1973821-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: 1635433542463100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eduardo Habkost Reviewed-by: Yanan Wang --- hw/core/qdev-hotplug.c | 73 ++++++++++++++++++++++++++++++++++++++++++ hw/core/qdev.c | 60 ---------------------------------- hw/core/meson.build | 1 + 3 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 hw/core/qdev-hotplug.c diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c new file mode 100644 index 00000000000..d495d0e9c70 --- /dev/null +++ b/hw/core/qdev-hotplug.c @@ -0,0 +1,73 @@ +/* + * QDev Hotplug handlers + * + * Copyright (c) Red Hat + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/qdev-core.h" +#include "hw/boards.h" + +HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) +{ + MachineState *machine; + MachineClass *mc; + Object *m_obj =3D qdev_get_machine(); + + if (object_dynamic_cast(m_obj, TYPE_MACHINE)) { + machine =3D MACHINE(m_obj); + mc =3D MACHINE_GET_CLASS(machine); + if (mc->get_hotplug_handler) { + return mc->get_hotplug_handler(machine, dev); + } + } + + return NULL; +} + +bool qdev_hotplug_allowed(DeviceState *dev, Error **errp) +{ + MachineState *machine; + MachineClass *mc; + Object *m_obj =3D qdev_get_machine(); + + if (object_dynamic_cast(m_obj, TYPE_MACHINE)) { + machine =3D MACHINE(m_obj); + mc =3D MACHINE_GET_CLASS(machine); + if (mc->hotplug_allowed) { + return mc->hotplug_allowed(machine, dev, errp); + } + } + + return true; +} + +HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev) +{ + if (dev->parent_bus) { + return dev->parent_bus->hotplug_handler; + } + return NULL; +} + +HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) +{ + HotplugHandler *hotplug_ctrl =3D qdev_get_machine_hotplug_handler(dev); + + if (hotplug_ctrl =3D=3D NULL && dev->parent_bus) { + hotplug_ctrl =3D qdev_get_bus_hotplug_handler(dev); + } + return hotplug_ctrl; +} + +/* can be used as ->unplug() callback for the simple cases */ +void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + qdev_unrealize(dev); +} diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 7f06403752d..cede76fce47 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -33,7 +33,6 @@ #include "qapi/visitor.h" #include "qemu/error-report.h" #include "qemu/option.h" -#include "hw/hotplug.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/boards.h" @@ -238,58 +237,6 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int= alias_id, dev->alias_required_for_version =3D required_for_version; } =20 -HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) -{ - MachineState *machine; - MachineClass *mc; - Object *m_obj =3D qdev_get_machine(); - - if (object_dynamic_cast(m_obj, TYPE_MACHINE)) { - machine =3D MACHINE(m_obj); - mc =3D MACHINE_GET_CLASS(machine); - if (mc->get_hotplug_handler) { - return mc->get_hotplug_handler(machine, dev); - } - } - - return NULL; -} - -bool qdev_hotplug_allowed(DeviceState *dev, Error **errp) -{ - MachineState *machine; - MachineClass *mc; - Object *m_obj =3D qdev_get_machine(); - - if (object_dynamic_cast(m_obj, TYPE_MACHINE)) { - machine =3D MACHINE(m_obj); - mc =3D MACHINE_GET_CLASS(machine); - if (mc->hotplug_allowed) { - return mc->hotplug_allowed(machine, dev, errp); - } - } - - return true; -} - -HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev) -{ - if (dev->parent_bus) { - return dev->parent_bus->hotplug_handler; - } - return NULL; -} - -HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) -{ - HotplugHandler *hotplug_ctrl =3D qdev_get_machine_hotplug_handler(dev); - - if (hotplug_ctrl =3D=3D NULL && dev->parent_bus) { - hotplug_ctrl =3D qdev_get_bus_hotplug_handler(dev); - } - return hotplug_ctrl; -} - static int qdev_prereset(DeviceState *dev, void *opaque) { trace_qdev_reset_tree(dev, object_get_typename(OBJECT(dev))); @@ -371,13 +318,6 @@ static void device_reset_child_foreach(Object *obj, Re= settableChildCallback cb, } } =20 -/* can be used as ->unplug() callback for the simple cases */ -void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) -{ - qdev_unrealize(dev); -} - bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp) { assert(!dev->realized && !dev->parent_bus); diff --git a/hw/core/meson.build b/hw/core/meson.build index 4d04069f85f..85f2ad1374b 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -11,6 +11,7 @@ 'irq.c', 'clock.c', 'qdev-clock.c', + 'qdev-hotplug.c', )) =20 common_ss.add(files('cpu-common.c')) --=20 2.31.1 From nobody Mon Feb 9 06:31:07 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=1635433546; cv=none; d=zohomail.com; s=zohoarc; b=S7yaC6YX8EdSyRKabp0FOwzkPrYnIB+HQMopG7GaF2bVhHRpoIzXKR3ivbDN+XsftlxIzN1teq2o8HNMC/oxyQuOQ7jk9OIJogPRN53BzKzWkYb3DwMiq2T509kcyl2vkWyJ4Bh28I65K0ALqVz/zhOTp9L47Ps4pp3qgEUHPO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635433546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8q5NxY4tZqQ6nhyl14l1qak+/GhyQMQefx1CQ7dFSew=; b=kSY45CAIG0fCJ1gZ3M2PtSYLdleeAh4NPuqvWOTaMu+VXp1lSDzW27S2fXMk6FncpUGVUlfvKkWTd8K/lvaGqY2GuIS+QRknzNm4CNGKfsaL30O5rk2U+nG8CmawjFJ/3rJ2tDXn0Ug2AQlXvJQodAhv4/E1oLFao9mpQ0MJRlI= 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 1635433546430476.2726629478076; Thu, 28 Oct 2021 08:05:46 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-UEUtt0GLPQ2WMUcU8Xv-Qw-1; Thu, 28 Oct 2021 11:05:44 -0400 Received: by mail-wr1-f70.google.com with SMTP id m5-20020a5d56c5000000b00168861c65f9so2252921wrw.0 for ; Thu, 28 Oct 2021 08:05:44 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id e8sm3468827wrp.58.2021.10.28.08.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 08:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635433545; 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=8q5NxY4tZqQ6nhyl14l1qak+/GhyQMQefx1CQ7dFSew=; b=GM5y7XINaRg+762D80/TVUxV9ISNZzWYkIFZvIw7jGwoLEd9pWigX0jyWuXhlbQM7lYoRs 9nM1qDfAk3bRh5jay2dyvrab3hP+B3LylZyLlxIlu1NeIJuLk6w0/gdi0LK7qvvi43zBz5 SbKubCXI5CWXCg1dc18ZTFHd72tAx1s= X-MC-Unique: UEUtt0GLPQ2WMUcU8Xv-Qw-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=8q5NxY4tZqQ6nhyl14l1qak+/GhyQMQefx1CQ7dFSew=; b=SLR1XH4tCD0GErtnRE2tSDhhSsVnpKbWk4WsoqS8AdHfz8vWjT0xOv65U8c7A8OX51 xcFVkTAz69+qksJ+WRj+ydDMezGuJgox+T1L7VvEKO0/JCHjzbhBFeL3SfNbhiExqtxL 44Gm7PV1waV+Wz7+DxZvpGIXo3+UjkH40zdmpOV9Ef/8yIwXE7FiuvBio7NE7EZks5TC Efd0VfxKR6PjUE1kvjSaDR86T20kktAWL/YBsIu8teULDzRY448+5reFETlCees5qRvP WhbEGZdAfKZ4xaLp9PIiEtansNJ1qeY35oSEK0mara22aj9zVhwq408i5wiJ844o7Kvk +O3A== X-Gm-Message-State: AOAM532JnQij+rkQ7lbO7g8MK6AQamjRBQweHU9XGO3vEjGjKS/YnNvg w451k4GmyDKS1TSeBZhrqCWjgyZ+5bhXoLeEGmyBltDawHyPVwOvCb8w9ZVUPMgMODIXQghpn0o AVPpF9wnE4w01iA== X-Received: by 2002:a5d:40c9:: with SMTP id b9mr6434983wrq.409.1635433542817; Thu, 28 Oct 2021 08:05:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd1kqs1by55shHybx9lNYM5phs/FDWTGPd6saDF/V6Wo9O75N5Gwy7mKGDkWq7aS/rAzA+QQ== X-Received: by 2002:a5d:40c9:: with SMTP id b9mr6434964wrq.409.1635433542668; Thu, 28 Oct 2021 08:05:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Yanan Wang , Eduardo Habkost , Igor Mammedov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] hw/core: Restrict hotplug to system emulation Date: Thu, 28 Oct 2021 17:05:21 +0200 Message-Id: <20211028150521.1973821-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211028150521.1973821-1-philmd@redhat.com> References: <20211028150521.1973821-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: 1635433547306100001 Restrict hotplug to system emulation, add stubs for the other uses. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eduardo Habkost Reviewed-by: Yanan Wang --- hw/core/hotplug-stubs.c | 34 ++++++++++++++++++++++++++++++++++ hw/core/meson.build | 12 ++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 hw/core/hotplug-stubs.c diff --git a/hw/core/hotplug-stubs.c b/hw/core/hotplug-stubs.c new file mode 100644 index 00000000000..7aadaa29bd5 --- /dev/null +++ b/hw/core/hotplug-stubs.c @@ -0,0 +1,34 @@ +/* + * Hotplug handler stubs + * + * Copyright (c) Red Hat + * + * Authors: + * Philippe Mathieu-Daud=C3=A9 , + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "hw/qdev-core.h" + +HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev) +{ + return NULL; +} + +void hotplug_handler_pre_plug(HotplugHandler *plug_handler, + DeviceState *plugged_dev, + Error **errp) +{ + g_assert_not_reached(); +} + +void hotplug_handler_plug(HotplugHandler *plug_handler, + DeviceState *plugged_dev, + Error **errp) +{ + g_assert_not_reached(); +} diff --git a/hw/core/meson.build b/hw/core/meson.build index 85f2ad1374b..afc5ed2c906 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -1,7 +1,6 @@ # core qdev-related obj files, also used by *-user and unit tests hwcore_ss.add(files( 'bus.c', - 'hotplug.c', 'qdev-properties.c', 'qdev.c', 'reset.c', @@ -11,8 +10,17 @@ 'irq.c', 'clock.c', 'qdev-clock.c', - 'qdev-hotplug.c', )) +if have_system + hwcore_ss.add(files( + 'hotplug.c', + 'qdev-hotplug.c', + )) +else + hwcore_ss.add(files( + 'hotplug-stubs.c', + )) +endif =20 common_ss.add(files('cpu-common.c')) softmmu_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c')) --=20 2.31.1