From nobody Fri Apr 4 05:51:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741475605; cv=none; d=zohomail.com; s=zohoarc; b=J5EEGnznr5NvBMcP0BCsGijjq364jZcH61n2klUpbKLVB6cM9aMvlwgluQXn082v3/tHbWCUAbZgJLqQlI28PqM5Y7iH4NYCkI8zdEXp76Gcm5zId9qLnpqEFpBfO3s69PanmecQ7n0cc/o1P1/4QjV+1kBbskF7Pm1CMoDIcoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741475605; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xZOLi7hVFZ5LkXmaV+OYfUEhNf7zzYjD6/tmTvULQjs=; b=QZ5WjlJ2m79Xp1925vKLJnm98BQ8uKTiNliVBAbaT/tXaRh3UTY6aUSwaBJaI7VeDuHaddcsx/t7znU5HA5WCJES+uw89xp3D0pZIlV3kpLyUlwqGJOpIWimdH40jQIzCXCF94+f3Lch3vrwNkQpt6VSWOlhjhzJA1f7CrPBcJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741475605985946.2725637320245; Sat, 8 Mar 2025 15:13:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tr3KM-0000am-74; Sat, 08 Mar 2025 18:11:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tr3K2-0008FJ-OU for qemu-devel@nongnu.org; Sat, 08 Mar 2025 18:11:11 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tr3Jz-0001aI-8B for qemu-devel@nongnu.org; Sat, 08 Mar 2025 18:11:10 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43cf06eabdaso1442095e9.2 for ; Sat, 08 Mar 2025 15:11:05 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bd4352eccsm126209355e9.27.2025.03.08.15.11.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 08 Mar 2025 15:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741475464; x=1742080264; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xZOLi7hVFZ5LkXmaV+OYfUEhNf7zzYjD6/tmTvULQjs=; b=vsle2s6wMRoG3EY19zbB5mkOPy6lx2q4fpqlZuuNOeB+/Uy9eDaKqdI14jbhCUXdUq p5+rviXG+ZgR42ri+55kbJI1CPBBA+wgCd1S8kAbkC2yWN9/p9hlWoqWTIP4mfGPFGxv fXGcbONdiq0tfXv3zudo3stxXFT8wHGpQ98FFNcMviCOopAlLye+ooaHm7n+h4JxTy3P awmWL4rPZteQ0+Wtflmjv4J3ClQtH5Ky6L2VqgxbjkXYKDBOCsNx7ozd5Bv+hlSfoDml tnS1aFdz6OZ2QT3rW4R3c7GDihlhOjcoRWEQdqz2zUEtiVFCyplPW2bnndOUbCfVxuft QqpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741475464; x=1742080264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xZOLi7hVFZ5LkXmaV+OYfUEhNf7zzYjD6/tmTvULQjs=; b=nrDII4mbcNjEMU0Z+2A7M4CsfmldjSaleHuh1Tozubc7I5IYprh6hfQcRJHKF8U8Yb H4piU/ErK/+c5rHg4LNUyM5F6OPpXQc97Yzgr0el2kqZFKEwld7mgMEE9bFii/6HHb98 5ziinAx7hzJG6sevjDRJluyu7mcHHYHQ5ufU+q7Ay2B15MG4o/m/hVnoL3zlbMWWonja A/FpgiR8LqXbHHPgIbehnEg3pG0dklkVvEgi4EZ+aNt1uDPWSVEpkhhcic0ey/myV32k zpELqBZr7kGy7yc3BBxGW5RZAZ/+xqjM3h+D5cmMujPN6kQBV82rEBS7D1JPbdHKyPP3 tX3g== X-Gm-Message-State: AOJu0Yz6kLOatmvvgt3st4AZtDibS5GdWbX2GFGKeJlwEfSRHi9GPWYu yaclARED43d3+NLt73auDU1FOQAzv/wcuGKxUjbvRG1ep469I/3p9/uAyxXFPK+m3QfRBRJQ75H RYgs= X-Gm-Gg: ASbGncvefWUAor8/LCD9NXvDRNR9eIWwUwTdWFPYxqJX8acPBbRVYsAPBQJZBiscPrG 7eLa/rPRnvFFU8ABqYU/M7Bd1htzK1NI2TlVWGFa+WaWi4cUZvRArDXE2l9vF+XoApmseEFXLQX QcJdQtz4l8ard3/JnQ/iofxWGS821BDOjw7Ys4kE95866aKVej5nYdbd62/d+n4/G86Ttxly2Qg kBfEck2lr9Ip/mgp/edPG6f6b+9d8NWMVxSaZ6V/tTDzbXky2nz48WFFiFQagJa8JKKeH4n3EDH eVLSTkH5kVTcOCT3yU8t41L8EBBDjZstsfl2gyqLwxxhGHd1bpOMBAJU0v/TNRW8MEo9UZxACR0 toxL7q0GEI/RD+6MH/tU= X-Google-Smtp-Source: AGHT+IGWy1gJ5oJ0bHv2ZZjJsgicnzsIu9r/rWofhhX1E8f5N83B9uErX1SevbWarzZRQU5Rb4Xxww== X-Received: by 2002:a05:600c:1c03:b0:439:9106:c09 with SMTP id 5b1f17b1804b1-43c6021f124mr55430515e9.26.1741475464444; Sat, 08 Mar 2025 15:11:04 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Pierrick Bouvier , Alex Williamson , Christian Borntraeger , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Tony Krowiak , Nicholas Piggin , Halil Pasic , Thomas Huth , David Hildenbrand , Igor Mammedov , Matthew Rosato , Tomita Moeko , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Eric Farman , Eduardo Habkost , Peter Xu , kvm@vger.kernel.org, Zhenzhong Duan , qemu-s390x@nongnu.org, Eric Auger , Paolo Bonzini , Harsh Prateek Bora , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Ilya Leoshkevich , Jason Herne , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 18/21] hw/vfio/ccw: Check CONFIG_IOMMUFD at runtime using iommufd_builtin() Date: Sun, 9 Mar 2025 00:09:14 +0100 Message-ID: <20250308230917.18907-19-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250308230917.18907-1-philmd@linaro.org> References: <20250308230917.18907-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741475607115019000 Convert the compile time check on the CONFIG_IOMMUFD definition by a runtime one by calling iommufd_builtin(). Reviewed-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/vfio/ccw.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index e5e0d9e3e7e..84d1437a568 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -15,7 +15,6 @@ */ =20 #include "qemu/osdep.h" -#include CONFIG_DEVICES /* CONFIG_IOMMUFD */ #include #include #include @@ -650,11 +649,12 @@ static void vfio_ccw_unrealize(DeviceState *dev) static const Property vfio_ccw_properties[] =3D { DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev), DEFINE_PROP_BOOL("force-orb-pfch", VFIOCCWDevice, force_orb_pfch, fals= e), -#ifdef CONFIG_IOMMUFD + DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), +}; + +static const Property vfio_ccw_iommufd_properties[] =3D { DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd, TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), -#endif - DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), }; =20 static const VMStateDescription vfio_ccw_vmstate =3D { @@ -682,12 +682,10 @@ static void vfio_ccw_instance_init(Object *obj) DEVICE(vcdev), true); } =20 -#ifdef CONFIG_IOMMUFD static void vfio_ccw_set_fd(Object *obj, const char *str, Error **errp) { vfio_device_set_fd(&VFIO_CCW(obj)->vdev, str, errp); } -#endif =20 static void vfio_ccw_class_init(ObjectClass *klass, void *data) { @@ -695,9 +693,10 @@ static void vfio_ccw_class_init(ObjectClass *klass, vo= id *data) S390CCWDeviceClass *cdc =3D S390_CCW_DEVICE_CLASS(klass); =20 device_class_set_props(dc, vfio_ccw_properties); -#ifdef CONFIG_IOMMUFD - object_class_property_add_str(klass, "fd", NULL, vfio_ccw_set_fd); -#endif + if (iommufd_builtin()) { + device_class_set_props(dc, vfio_ccw_iommufd_properties); + object_class_property_add_str(klass, "fd", NULL, vfio_ccw_set_fd); + } dc->vmsd =3D &vfio_ccw_vmstate; dc->desc =3D "VFIO-based subchannel assignment"; set_bit(DEVICE_CATEGORY_MISC, dc->categories); @@ -716,11 +715,11 @@ static void vfio_ccw_class_init(ObjectClass *klass, v= oid *data) object_class_property_set_description(klass, /* 3.0 */ "force-orb-pfch", "Force unlimited prefetch"); -#ifdef CONFIG_IOMMUFD - object_class_property_set_description(klass, /* 9.0 */ - "iommufd", - "Set host IOMMUFD backend device= "); -#endif + if (iommufd_builtin()) { + object_class_property_set_description(klass, /* 9.0 */ + "iommufd", + "Set host IOMMUFD backend de= vice"); + } object_class_property_set_description(klass, /* 9.2 */ "loadparm", "Define which devices that can b= e used for booting"); --=20 2.47.1