From patchwork Sat Mar 8 23:09:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 871638 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp349325wri; Sat, 8 Mar 2025 15:13:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXi3jXVQJbjYhsrCXJhbYxpNG0qaBL0rAuEsHFq1DFlDnAxdrWrd26p9uek3NiPc97ezF8mSw==@linaro.org X-Google-Smtp-Source: AGHT+IFahFwPsJzZMkJl/gRLKFN4jKC5jK3S9Qc6TUlRfc23ay/I9BIn3PVh65der5i+bDDNEQZr X-Received: by 2002:a05:620a:2605:b0:7c0:cc94:46c0 with SMTP id af79cd13be357-7c4e167d7ccmr1276095285a.20.1741475605865; Sat, 08 Mar 2025 15:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741475605; cv=none; d=google.com; s=arc-20240605; b=PvVdaKVHolbFdSZuKNCKxwOEZQYpZA3dlvR366sk9BqDOugfwxTRMPYJK0WOQM+Nv0 R1P/h+gM8ru6l9yZkcITTnCmnMvjucbQMxZn7UXJ4oIL4DV+Fikz5f9MES9F6JP1ApMk KJr7JnzuW9Z56yAjZGEhzDGVlBvRJNL4C8UaJ+Cks1EvDV29EP6BYnqis4HSMpd0UKRs 8FXe9HthmUZ4HAiB+DXv+Fuquk9nlNBvGjHo2lzG8NpPhWiofwVcxRKIH/8oIGp/Km8U uEM14ZJ2lECnEwx9JqedeqXAKgcK8xDYFXnwllmzWlpRQIsMHjbkZhOMcGISgnHZNcl6 4jmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xZOLi7hVFZ5LkXmaV+OYfUEhNf7zzYjD6/tmTvULQjs=; fh=K+jvfEXLHI1+aHeREoW+qFHLwqI2jh7KnZNeFexCTwE=; b=JapYcxl8n0Yx0riKpRSnXvi0vRPj9occZsN38RD1bQwo+9miOEBkW1IB46FZ9Z/osH D/HjooDSzYTH0rsIO1SEeEJt90Ldyx1fkuzorUXaEu6fw7thkYmpWspi3Nt2BWDmhATI aORuoqv/06L+I7jTTaTrfzyMfCOf6z5ChAmaMdEW7ac0E2ocbqGRbaivvtU5kiIujcVY Albmxccs0+i96tlNyWQPXeGZ54fIUF6jLAwLpqFmIBLBasrnOFa6typQAO37QDggaOdA Jdg4JPk/sRq/0RZDKc+k4HHtDQlxyjxU8DkN9G080oJ8qtLO9FJvJ5iLTl2+6if2iLaL gBbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vsle2s6w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c3e536a9ebsi627525485a.174.2025.03.08.15.13.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Mar 2025 15:13:25 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vsle2s6w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Pierrick Bouvier , Alex Williamson , Christian Borntraeger , =?utf-8?q?Alex_Benn?= =?utf-8?q?=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_Le_Goater?= , Ilya Leoshkevich , Jason Herne , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 @@ */ #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[] = { DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev), DEFINE_PROP_BOOL("force-orb-pfch", VFIOCCWDevice, force_orb_pfch, false), -#ifdef CONFIG_IOMMUFD + DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), +}; + +static const Property vfio_ccw_iommufd_properties[] = { DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd, TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), -#endif - DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), }; static const VMStateDescription vfio_ccw_vmstate = { @@ -682,12 +682,10 @@ static void vfio_ccw_instance_init(Object *obj) DEVICE(vcdev), true); } -#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 static void vfio_ccw_class_init(ObjectClass *klass, void *data) { @@ -695,9 +693,10 @@ static void vfio_ccw_class_init(ObjectClass *klass, void *data) S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass); 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 = &vfio_ccw_vmstate; dc->desc = "VFIO-based subchannel assignment"; set_bit(DEVICE_CATEGORY_MISC, dc->categories); @@ -716,11 +715,11 @@ static void vfio_ccw_class_init(ObjectClass *klass, void *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 device"); + } object_class_property_set_description(klass, /* 9.2 */ "loadparm", "Define which devices that can be used for booting");