From nobody Sat Nov 23 22:55:31 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730754509; cv=none; d=zohomail.com; s=zohoarc; b=lWqjjOZ7KCAblURzuO7BgQA7K9epBk9KNyKq9SSpAY4Gn1aL61wJZ/3aFiIwm0ccLRevOiXw4uQoCp5VnKcwS8RtKEjbftGYytmfPFF3OE1UaHeO/w+9f2gHXM/5nxbS2dhG9TG/GrRjlG/GcvKdFtrR+MvIcv19p34UD2nZpqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730754509; h=Content-Type: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=wlEJlaD4rUuzda7f+a8uqDdCRzttqpEXwtLO90XFWes=; b=fawESsn6T8AjZrlZQ+Hl6zVR66W/C5qIpkJmRHhVRWsKS4fV3dtOKsp9GmgDENGX/s/FClwBtXPw7Iu22d7DjOjakXMF0BTZOl2QacgXA34hgkpXyw9NiM8cpKNozsmSPH3sR3IbtjDYvDiJBGdl38bc/SNu+elHnTzqPNzo0Hw= 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 1730754509001654.7167099598972; Mon, 4 Nov 2024 13:08:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t84Ij-0002V8-I9; Mon, 04 Nov 2024 16:07:53 -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 1t84Ie-0002Bf-PO for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:07:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t84Id-0005PX-8K for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:07:48 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-uOmstuEKPYmvZB70NbgKGA-1; Mon, 04 Nov 2024 16:07:45 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d59ad50f3so2040294f8f.0 for ; Mon, 04 Nov 2024 13:07:45 -0800 (PST) Received: from redhat.com ([2.52.14.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7bf7sm14347574f8f.9.2024.11.04.13.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730754466; 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: in-reply-to:in-reply-to:references:references; bh=wlEJlaD4rUuzda7f+a8uqDdCRzttqpEXwtLO90XFWes=; b=hECaGtn83+pob7Ae833LUY+dVPS2iJlG/Vrnch8Mr67LDYi7Eetiia1N3pttNKZFF7i7AC FW1W3ZlBK/p/p1+tL1iGfE/PzOmyTMy9beCsXApuBCH2U4Bpxyrxpcps+ucIi58Xlje8Ju gIqmsbrn0f1+CzKxUTyWP5nZwoRYIpU= X-MC-Unique: uOmstuEKPYmvZB70NbgKGA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754464; x=1731359264; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wlEJlaD4rUuzda7f+a8uqDdCRzttqpEXwtLO90XFWes=; b=DS2ifeZ+j4r43u6jNYyGHZbpJFiXbjVJmLtUCuP6bmkDq2HRSmlVoEKdRbNgx+dQvz LMK0E/ZqV8jeKfLayJLDN4ge+rtFuyKEHpMRGswPpaFC6Hxm9WyqiyCMS+AJksnNk5Ea Stshl56jIL8IqdHciYVA0JDQ5gQJIRZpn0N2FuIGDtFjE8ul2ZXdyJEcSUA60iHF/FbL N+bVxBlIbkce1y73PbC5wg9xkEqOTRMoxWxWs11h+NEypAfGZrDTU+YoUBC6ZXkNssmo VjAOHPXc457DWSen118En8/sX0mfg9f8wM/KqQicJtNZv4InTjCWzuEEv6vmDDl2KAZ0 ewJw== X-Gm-Message-State: AOJu0YwQDozKlS0b8Ul4p/16QklyU+nCp1b4RShOFQTD3ZNMC4AxAT54 tA8q9ZXM4To9ekTgfRBMCzwuUXmRCGikA3v8rCfGzI47m5MD/82YgmwbQsdMAQRfhjA/WVMEKa9 LbTvHkFmesUOorgNprOWi5wuI7pLNcXiX7ysptr7CfH1xD77XteLJQNQt3fZ4BfLpOIw6piyke8 EIcLzobstK5pCgDh6qyZdvjcQ2Hcqzdg== X-Received: by 2002:adf:e84f:0:b0:37d:4956:b0c2 with SMTP id ffacd0b85a97d-3806122f97emr23131446f8f.58.1730754463982; Mon, 04 Nov 2024 13:07:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHo0EeQBfWx0HoVLiVSOHZMoydRGICAHX+9E9mzd4tPJCajEwJMtYYqFdptKkUMDdamaW3m/A== X-Received: by 2002:adf:e84f:0:b0:37d:4956:b0c2 with SMTP id ffacd0b85a97d-3806122f97emr23131427f8f.58.1730754463475; Mon, 04 Nov 2024 13:07:43 -0800 (PST) Date: Mon, 4 Nov 2024 16:07:39 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Suravee Suthikulpanit , Alejandro Jimenez , Santosh Shukla , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 32/65] amd_iommu: Check APIC ID > 255 for XTSup Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 @redhat.com) X-ZM-MESSAGEID: 1730754511390116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit The XTSup mode enables x2APIC support for AMD IOMMU, which is needed to support vcpu w/ APIC ID > 255. Reviewed-by: Alejandro Jimenez Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Message-Id: <20240927172913.121477-6-santosh.shukla@amd.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 38297376e7..13af7211e1 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -32,6 +32,7 @@ #include "trace.h" #include "hw/i386/apic-msidef.h" #include "hw/qdev-properties.h" +#include "kvm/kvm_i386.h" =20 /* used AMD-Vi MMIO registers */ const char *amdvi_mmio_low[] =3D { @@ -1651,6 +1652,16 @@ static void amdvi_sysbus_realize(DeviceState *dev, E= rror **errp) memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST, &s->mr_ir, 1); =20 + /* AMD IOMMU with x2APIC mode requires xtsup=3Don */ + if (x86ms->apic_id_limit > 255 && !s->xtsup) { + error_report("AMD IOMMU with x2APIC confguration requires xtsup=3D= on"); + exit(EXIT_FAILURE); + } + if (s->xtsup && kvm_irqchip_is_split() && !kvm_enable_x2apic()) { + error_report("AMD IOMMU xtsup=3Don requires support on the KVM sid= e"); + exit(EXIT_FAILURE); + } + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); } --=20 MST