From nobody Thu Sep 05 02:43:33 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WzkFL0xr0z5WYLx; Thu, 05 Sep 2024 02:43:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzkFL0QxNz4jsw; Thu, 5 Sep 2024 02:43:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725504214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dX7CkyZIvy25bHCuhEoi1Qswjyng+AYMWEQHhzkgiGg=; b=pvtsvaZjRp640A/Kmkvjrv2ys0wvfwZuEtXpSNGboD05U0Asw4iO/HeMZJzq6caqvm3Y3N awt+c+DnJMAap2ZcBxlltSnkv+hWicuBZmxcpoM/ZHCHlkDJR447+A5D7yOzt7x8Id/S9Z aqg4J4gBwyY4rj3WMMpFrUf1YYoWqH1c7fVODjUGN6W1Dx/p114LNbVMs7pe/ZQIRNnlhh JpP9L1IocrGEIGIwI8bpBKi9s1KWq7pl1P7KpIeWMOFs9uSmM9LFFIhSdIclz8eXMhKL3j UPtuj4E1B1bj/Ccx/RLEDw0o2CSun59Etv966d2j5fM54OLlzDP7uK3RdmyD7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725504214; a=rsa-sha256; cv=none; b=qD6AaarwKpTTkPMVa8hgR18OwXbtoBGoReV0jB0iTuhL0so9/NyzbRJv3R0q1Yxi4VgmQt iC9TWog/7EGGd/mhIWcrGXDbTDHO6eb0VGExmsAzN9+AKFBgK7AdNifYXbxStMB3x/5bQd LwGP/riiRSfaGAjjFVG1kU3+bcqH/Q1DdnAcIBw5QT0WfzXB63MlkCtWrMwQAEuqSIHkRx DyGeUWXn8KL0xP0F8Uqv9ezPasEglLltgfZmBa5mO6T9oLHJ/WzyAk6ZRUdICKVkFbLOAI ts7R2vVBBWMy9zK7JRf2X7QtQvS3ygIKDwQkHVEraaEAp0HB+HqcIUQagXywSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725504214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dX7CkyZIvy25bHCuhEoi1Qswjyng+AYMWEQHhzkgiGg=; b=SkkO9ZA/JCLa/dBGWURkTdq2Nv9KtGUW49bpGG8vwqIza45KMwF9e0Ni7X72ZJzl3yoCzC oS/6qraG2fdldx5NOjWDo+2UYSAkDvYBGOrR2prlgGIVsTXqKfK3PT8BrDWACROKsX7w48 ludcXV6RR3ZcqeS95WmjI6FfBFiCiE9PI8xv9/b3kET5KEatVTo7SEC9vugFeDFZaUynaA 8NnrlzUb5m6P6UMYEJA0e0Q3e1tagRZIhw+Ghm/aBMBwqInifFjlkUzZJ4OBWv/nN9Xshm BrhHn5inej4MPgrIE1VKlC+jvD0aLfatFq65QXg11rvhVYF2AtsL5TpdZmsf0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WzkFL02LWzqyR; Thu, 5 Sep 2024 02:43:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4852hXiA029242; Thu, 5 Sep 2024 02:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4852hXOP029239; Thu, 5 Sep 2024 02:43:33 GMT (envelope-from git) Date: Thu, 5 Sep 2024 02:43:33 GMT Message-Id: <202409050243.4852hXOP029239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 99e3d96fc1a2 - main - x86: always provide dummy x86_iommu virtual methods List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99e3d96fc1a2b1d5cac5a635608ec3044ec4fa13 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=99e3d96fc1a2b1d5cac5a635608ec3044ec4fa13 commit 99e3d96fc1a2b1d5cac5a635608ec3044ec4fa13 Author: Konstantin Belousov AuthorDate: 2024-09-05 00:33:34 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-05 01:30:29 +0000 x86: always provide dummy x86_iommu virtual methods to make configurations where vendor-specific IOMMU not yet implemented but IOMMU is enabled in config, work when calling into MSI/IOAPIC interrupt remapping. Reported by: cy Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/iommu_utils.c | 52 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c index 2c647fd21c67..2011c632f770 100644 --- a/sys/x86/iommu/iommu_utils.c +++ b/sys/x86/iommu/iommu_utils.c @@ -190,12 +190,60 @@ SYSCTL_INT(_hw_iommu, OID_AUTO, batch_coalesce, CTLFLAG_RWTUN, &iommu_qi_batch_coalesce, 0, "Number of qi batches between interrupt"); -static struct x86_iommu *x86_iommu; +static struct iommu_unit * +x86_no_iommu_find(device_t dev, bool verbose) +{ + return (NULL); +} + +static int +x86_no_iommu_alloc_msi_intr(device_t src, u_int *cookies, u_int count) +{ + return (EOPNOTSUPP); +} + +static int +x86_no_iommu_map_msi_intr(device_t src, u_int cpu, u_int vector, + u_int cookie, uint64_t *addr, uint32_t *data) +{ + return (EOPNOTSUPP); +} + +static int +x86_no_iommu_unmap_msi_intr(device_t src, u_int cookie) +{ + return (0); +} + +static int +x86_no_iommu_map_ioapic_intr(u_int ioapic_id, u_int cpu, u_int vector, + bool edge, bool activehi, int irq, u_int *cookie, uint32_t *hi, + uint32_t *lo) +{ + return (EOPNOTSUPP); +} + +static int +x86_no_iommu_unmap_ioapic_intr(u_int ioapic_id, u_int *cookie) +{ + return (0); +} + +static struct x86_iommu x86_no_iommu = { + .find = x86_no_iommu_find, + .alloc_msi_intr = x86_no_iommu_alloc_msi_intr, + .map_msi_intr = x86_no_iommu_map_msi_intr, + .unmap_msi_intr = x86_no_iommu_unmap_msi_intr, + .map_ioapic_intr = x86_no_iommu_map_ioapic_intr, + .unmap_ioapic_intr = x86_no_iommu_unmap_ioapic_intr, +}; + +static struct x86_iommu *x86_iommu = &x86_no_iommu; void set_x86_iommu(struct x86_iommu *x) { - MPASS(x86_iommu == NULL); + MPASS(x86_iommu == &x86_no_iommu); x86_iommu = x; }