From patchwork Mon Aug 19 01:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Si X-Patchwork-Id: 13767702 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5B09FC02 for ; Mon, 19 Aug 2024 01:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029331; cv=none; b=OjR7rmqFz+fJEoofIPsg3ycl16U8sjExS8hDTTgCkWpSqous+M/hWsRG8VEdYgOaFkblhkF+jKymtpfdU70yRAFIsKyyjFRk/oWTQRsuOk6dijBDUqpUqnQMA8mobZL50PHgF2nlOI2vjSoiHTtXJEabQmufFIv/qLQdM/kJX1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029331; c=relaxed/simple; bh=2kzd7G/Pe4tgcXPkQ62/SfYOrC0tBK4PckC6GHZzlpQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=rnYbMUCL7COrlTDw6QOYK9C0oxczewNUcLDlTwKhG1nISc5MQjOlu60wFg99UU7Hm+W85AjBLGLRakoRlfbeNv1OFOz9WUFOK/Lep32b0VpSqM9G/02uVIP6RF6Aop8DtoZOEwaYoYQOnI5iu4e2kgZ/JJNnbVwjKLi46pfwicE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SKi3hA9G; arc=none smtp.client-ip=209.85.216.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SKi3hA9G" Received: by mail-pj1-f67.google.com with SMTP id 98e67ed59e1d1-2d3c05ec278so2537611a91.0 for ; Sun, 18 Aug 2024 18:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724029329; x=1724634129; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/E8CEOT1/HPFlUo2VocSkNU3W/VJweNzQb1pGEp2ypE=; b=SKi3hA9GXNajkfoz+j8VzRLZqcp9rkB70/CvYX7y4wFUxpCKOjc/AUWp7qP/iXkDS8 DDnK5NBIfTgQbhwxOS72vDYC2IeiTuqWfTpSyiuXhZwntEUCxTuP+pUWHUUi31vL0LNE 8upXRIK0YON/dBZsEXt2iVdLKfs7LA0cPRZVnMa4cTDuuSVZFIC4e5RGtRKs8s3OY1tp 3P3I++HWJLEkj5uAGRc8OuCQApJFpMF+wo1s5VzFrx+5OeEuCzsU3MiCHP44bDUiG19t LVtFcbn6GkEr3w9i8en4FzVjTddJF6ckMWtMKx+mRqJ34deFdpQdlXQtMDqTubH/+x9A HdbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724029329; x=1724634129; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/E8CEOT1/HPFlUo2VocSkNU3W/VJweNzQb1pGEp2ypE=; b=RdsT7aisaPZUBgyGkkqo5RsdhsMc8Ipu7/UAYC8t+aohjuGbMaSg5w3EO7zkHE59kN 5TK6dTutoja/671ltuK5oFw6LIQWvs5wMUjMB81BPc93FOBMolyAuWHE5GHXCOKMf49m UTrtnzR5K2+vubtIC4Xpkru0BPZN/xVpT21i1zbbQIyAfDVxMKhNNM2aetjiBwFPlKxa q6NAwcccOkc/3vtESwlVv1EiVTVNOUabt8IVnk719FAwYykwCqh+ArA8nuiBxQ9J1N1G nsYUTDcviBxJEfuLCcBv7c0Ir78USdOkK7n6OAGETBrx4N5vbCK99V2t29Fm75EsfRAh PcNA== X-Gm-Message-State: AOJu0YwvKRFrp0XV9fw0BlPrASVwZO+XP3W19b1G8gGmb3VdvxFCkvRg 99zDqcceHOs79zLInHrBoDBRCeJentL1aJ2kPKu9y5noN7cXubeTOVtuWKYBdFo= X-Google-Smtp-Source: AGHT+IHxS0GbvV7xNnO4bQgzcxFvajkhLAO6ZeoXSGD83R55yiFchewdRw3VST/JdWphv4SeNie2ng== X-Received: by 2002:a17:90b:1091:b0:2cf:cc13:471a with SMTP id 98e67ed59e1d1-2d3e04128ebmr7483026a91.43.1724029328839; Sun, 18 Aug 2024 18:02:08 -0700 (PDT) Received: from localhost.localdomain ([45.63.58.14]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3ac7f2276sm9834708a91.29.2024.08.18.18.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 18:02:08 -0700 (PDT) From: Dongli Si To: kvm@vger.kernel.org Subject: [PATCH kvmtool 1/4] x86: Set the correct srcbusirq of pci irq mptable Date: Mon, 19 Aug 2024 09:01:54 +0800 Message-ID: <20240819010154.13808-1-sidongli1997@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The srcbusirq should be pci device number where the interrupt originates. Fix it. Fixes: f83cd16 ("kvm tools: irq: replace the x86 irq rbtree with the PCI device tree") Signed-off-by: Dongli Si --- x86/mptable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/mptable.c b/x86/mptable.c index f13cf0f..f4753bd 100644 --- a/x86/mptable.c +++ b/x86/mptable.c @@ -180,7 +180,7 @@ int mptable__init(struct kvm *kvm) unsigned char srcbusirq; struct pci_device_header *pci_hdr = dev_hdr->data; - srcbusirq = (pci_hdr->subsys_id << 2) | (pci_hdr->irq_pin - 1); + srcbusirq = (dev_hdr->dev_num << 2) | (pci_hdr->irq_pin - 1); mpc_intsrc = last_addr; mptable_add_irq_src(mpc_intsrc, pcibusid, srcbusirq, ioapicid, pci_hdr->irq_line); From patchwork Mon Aug 19 01:04:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Si X-Patchwork-Id: 13767703 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0F1110A0C for ; Mon, 19 Aug 2024 01:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029485; cv=none; b=sb0SQB6htrIZX42JNvQ0BXwNn7yQYZQ3wIhKa7rjY/iTUlNZBlUh+mB1uXBWznNNjFRKTj32aLXNCsRU61tTeHaB7AnVwC4jZPYkeoLL4gR7FF5waqrcyD82pQStoEb5G64cB05PGEYRFkprs0G6ojIWmepcOfCad9vw/rolrts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029485; c=relaxed/simple; bh=Y4/pvjoHgRFY6mCbKH+DK/2YiMcMuVOofpCFyOolc6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r59NraUXyN0I8ki7+0pGFD9Gojw3WLwLnH7vP84jeZ7uivRe0njlYDVuCgPBa91ZZCJrXTo7ufpj+AiwfxoqlR0lUxCEsP8xkPj6FMrk4DtrTg4xKO+7UafUov+57ubPs/LMUA4UCu5su7R3mie59SNSiJcd2i8T+IdymxVJc0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U+XAcUxD; arc=none smtp.client-ip=209.85.214.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U+XAcUxD" Received: by mail-pl1-f196.google.com with SMTP id d9443c01a7336-2021a99af5eso12360875ad.1 for ; Sun, 18 Aug 2024 18:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724029483; x=1724634283; darn=vger.kernel.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=qTe4pMoweYqHTL0yLGfICkCC/EGnVC9HjE1ZA80wPxM=; b=U+XAcUxD6iBDF96vfzHvvtK6HgMBkEuby8RGA9OzPePlvCl5c8PyYM+ibWd0PpSaq5 ln+sXiqYeH6yQfhGnE+a66tC4D6UDSIdqTxhgEfXkQj3dtSnFZvm1TZ9wa2UEEjobJLj KE6mdZZ3FEkbpdc2COweE6K7SubaoCFyL9fw9KDDSBCJcBrTxOiKRlHjVdMTB46l/nOm QqTV+3I4RSUURjEbuPLy0QBirw0azmEIRVrfXOwv8Tvwb1a8Qa5m76Gm43VFeRhwX11E EXfZ8SR0xF1ovY7Qb6GCz53oJGzbaOYEazmiUOnYayjI8jjWYfOWo4YORMx2YukFP00S WW9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724029483; x=1724634283; 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=qTe4pMoweYqHTL0yLGfICkCC/EGnVC9HjE1ZA80wPxM=; b=kGX/xFTsBzR05cCSW96yBcsQ7MuBt3EdQ+Pj0SZOHWYITnpNLGObpnpCTQPVPCFQYJ wdcpg7gxiyBFGPdOXcyTQAbXOzHBjRYMRnB40+SdVWosMYvlHOZQSGLzAr4GQLhapmZC bqStCQ1NusNHfFlRiFE3yPd4VGjjMXH59ETOPGqDgfJAKdhmYSDLmV+Z4kn5P+4WjvnR uVGSPoHjyiudeZe7/c66zEl8rKL4KQ575rlSjjPrMWHLDvV3UpXDaJPvP3XQ8+qvR3ms dxdzuusR/rQbay6ZSsAiI5huhdhoBGuqsfz/tM6SysoqDL0D2wZlrTe3j3jHckMLB/gI 6g3A== X-Gm-Message-State: AOJu0Yw0fxKI/AUwuBIgQvVD/8HCsALh+KqPoEyB18+HU0TjKxbZbC9h P7lfg8I9CXZGB4o0Y10DgGdajJodSSziLBCxgd/mT/QvvrmV7TsktV0ZuFkm4Es= X-Google-Smtp-Source: AGHT+IHiPWTS02fh9JtViKU1lI/aGNz1dHX3GgRgQMMl6xkpywWskON3Dw/tOBTkwXK3uph6/swewg== X-Received: by 2002:a17:903:32c9:b0:202:bc3:3e6e with SMTP id d9443c01a7336-2020bc33fc8mr108220625ad.33.1724029482880; Sun, 18 Aug 2024 18:04:42 -0700 (PDT) Received: from localhost.localdomain ([45.63.58.14]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f0375626sm54501495ad.156.2024.08.18.18.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 18:04:42 -0700 (PDT) From: Dongli Si To: sidongli1997@gmail.com Cc: kvm@vger.kernel.org Subject: [PATCH kvmtool 2/4] x86: Add the ISA I/O interrupt assignment entries of mptable Date: Mon, 19 Aug 2024 09:04:21 +0800 Message-ID: <20240819010421.13843-1-sidongli1997@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240819010154.13808-1-sidongli1997@gmail.com> References: <20240819010154.13808-1-sidongli1997@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to Intel MultiProcessor Specification: "There is one entry for each I/O APIC interrupt input that is connected." Missing this will cause the guest kernel to report some warnings or errors when enabling the io apic. Fixes: 0c7c14a7 ("kvm tools: Add MP tables support") Signed-off-by: Dongli Si --- x86/mptable.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/x86/mptable.c b/x86/mptable.c index f4753bd..82b692e 100644 --- a/x86/mptable.c +++ b/x86/mptable.c @@ -171,10 +171,8 @@ int mptable__init(struct kvm *kvm) nentries++; /* - * IRQ sources. - * Also note we use PCI irqs here, no for ISA bus yet. + * PCI IRQ sources. */ - dev_hdr = device__first_dev(DEVICE_BUS_PCI); while (dev_hdr) { unsigned char srcbusirq; @@ -189,6 +187,23 @@ int mptable__init(struct kvm *kvm) dev_hdr = device__next_dev(dev_hdr); } + /* + * ISA IRQ sources. + */ + for (i = 0; i < 16; i++) { + if (i == 2) + continue; + + mpc_intsrc = last_addr; + if (i == 0) + mptable_add_irq_src(mpc_intsrc, isabusid, i, ioapicid, 2); + else + mptable_add_irq_src(mpc_intsrc, isabusid, i, ioapicid, i); + + last_addr = (void *)&mpc_intsrc[1]; + nentries++; + } + /* * Local IRQs assignment (LINT0, LINT1) */ From patchwork Mon Aug 19 01:06:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Si X-Patchwork-Id: 13767704 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C815D1BC20 for ; Mon, 19 Aug 2024 01:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029613; cv=none; b=WAJaRHAvpuXgBjnup12TU+oE+gwi4l31ax9qjDFrB00NpNWDWi+EpTiut7SbSn+Q19TSMSEcLyOhkxSxmZ9+lR9f52w5gRvsMk8okMQVEWV8cMFcIQoycG6Y+T2sSpavGnabRCIDFOvU21VXllH+J+hA/x0Q9bK8cPahJtYEwX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029613; c=relaxed/simple; bh=yQtneJNu6ZagGjhdtfRQoyCJf5yMN8rUVsK9/kqzDzM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OLU08i/8+xR5/ZPa4SinYZ5AbAAXqLHbIGMXnkF4joIF1G02wWpfR/ImZDhV+4GzMYzilZ+mIzmfzHBr/tcrGqB5UwtHX9WbNRqstw7AaHkC1XvS75WBxQMoE/cF2v6YbJ9PsP3PORgOno0PDJ5Hv+vvSgYLq+s5UxvZuM7R9IM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dGEFkBcJ; arc=none smtp.client-ip=209.85.167.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dGEFkBcJ" Received: by mail-oi1-f196.google.com with SMTP id 5614622812f47-3db16a98d16so2358255b6e.0 for ; Sun, 18 Aug 2024 18:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724029611; x=1724634411; darn=vger.kernel.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=h8DMONrCq5KQTQXp7Rw7pTf0+PDkeHOFVckSuH74uqc=; b=dGEFkBcJg+blDvo4ocGApUgg7ae1rpy3IammipMKUwhrSv8iRcvWCuFrVQrShPh3Or +rTg2+6NU/YDQTZ+u91fU6ZvgrbQaDVqddhnlVilfo7wSLbDUvPJmkRfXm99pjs81C6j VznPP6hwof0WAf52+fffIZqCI3SSqfPE6DfBQYPuX1sm7Lxfzy83A9nyxHVCqVIA+gW/ CKzSd69nfJ/UO5jYEsjPCbA1snrQm7dEhDkd5vNndOsA2IUc2Cu91Z6gKiFWtx2IV4VA uV4Zb+c9R3xe5esT6Qjd/3QZRhnVMCPujCfxNivE37ZnGyw+uq9zi7XqPu9WFFa0n58j srrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724029611; x=1724634411; 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=h8DMONrCq5KQTQXp7Rw7pTf0+PDkeHOFVckSuH74uqc=; b=hwoyyDKWHjdethmgR8edPNVEkjubaHkXSl65oR0KyiFlzd/1NylWvfqAGo60XgUPST obj65TW3Vos0CNtaFf/ujbnf1i6wo2vl4O8JGcvSubabgSnZgsTKAhFTnSOrGDlCyfKz PximqlaBSC5BVh5wg91jh7DW7rWbjPswzE27WeXf5EvQVr86HuFHxfQ1lM9raX7VODRq RrFbgoWGSsw3n34pMGtX2DxW7ZTKmitNCwT/EFsYPzUf8SBmIlI9uy+sjl6Ij3drzWh4 ZAN96BNdRTtPM43uogdpTDpt2xT0HrHTPNSZ4IjxpnSGYypLKiUPYo3FwRgL1/FVr8kV FFmQ== X-Gm-Message-State: AOJu0YyGBsuniLFmLogZVlqi2tJS7MIrWh1MMJSKOxioqv01s0j+hbeQ bOdvQ5v3zTwBBCNni0Dgws8TcS7+rdrvXjT/Of3koCpUDTYWNQr0 X-Google-Smtp-Source: AGHT+IEFiTrUDZN3WYOajNbC7RewQtzXTod6o4ykKgLxRNilTkKP81hAi3+iM6S/JifxwfTyCDFCzw== X-Received: by 2002:a05:6808:1147:b0:3db:2fe8:691e with SMTP id 5614622812f47-3dd3ae430acmr10938867b6e.42.1724029610778; Sun, 18 Aug 2024 18:06:50 -0700 (PDT) Received: from localhost.localdomain ([45.63.58.14]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7c6b61a93aesm6519897a12.17.2024.08.18.18.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 18:06:50 -0700 (PDT) From: Dongli Si To: sidongli1997@gmail.com Cc: kvm@vger.kernel.org Subject: [PATCH kvmtool 3/4] x86: Remove the noapic option from the kernel command line Date: Mon, 19 Aug 2024 09:06:42 +0800 Message-ID: <20240819010642.13897-1-sidongli1997@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240819010154.13808-1-sidongli1997@gmail.com> References: <20240819010154.13808-1-sidongli1997@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When running guest kernel 6.9 and later and above and the number of vCPUs is greater than 1, dmesg reports: [ 0.009932] CPU topo: CPU limit of 1 reached. Ignoring further CPUs Only one CPU is available at this point, solve this problem by enabling io apic. Signed-off-by: Dongli Si --- x86/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/kvm.c b/x86/kvm.c index 71ebb1e..e07d964 100644 --- a/x86/kvm.c +++ b/x86/kvm.c @@ -130,7 +130,7 @@ void kvm__init_ram(struct kvm *kvm) /* Arch-specific commandline setup */ void kvm__arch_set_cmdline(char *cmdline, bool video) { - strcpy(cmdline, "noapic noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 " + strcpy(cmdline, "noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 " "i8042.dumbkbd=1 i8042.nopnp=1"); if (video) strcat(cmdline, " video=vesafb"); From patchwork Mon Aug 19 01:08:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Si X-Patchwork-Id: 13767705 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A7CC1B5AA for ; Mon, 19 Aug 2024 01:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029745; cv=none; b=eP4HeTmT2ZABLwNr6mLmjcnZIVB1tHiZDaSyKjsbUk2OhkC2GmeML91WF6P/NKZ+aCaJTGsv4NN6XlLgR+508jostKLvhrBZ28kHoe6btbZ3BjmhAVf8GZeW3sBNlp00NdInpHwxKRinLxQ1F//5eO2AKBPIsl0XUE/Dl1auH74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724029745; c=relaxed/simple; bh=4hklxyNUlvbMhY5isYEfK16mjKhTfZdZJYUzsuumq38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G96XPIezZyXliorNTmNmPyOiHopNYxAzki0uF36nmWz9mQYgibL9lAxaFaArsOvYt7glWwvfEQj/0ohP3RBW4LilWps8milcYbgY5LuCr1RK8NnDGYJyahjNNBXYGIm55scMR5d9zJPEDOu2UISxh7reY4Ull+qlf2gMNYgSssk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iS4Ylxgy; arc=none smtp.client-ip=209.85.210.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iS4Ylxgy" Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-70d399da0b5so3295936b3a.3 for ; Sun, 18 Aug 2024 18:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724029743; x=1724634543; darn=vger.kernel.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=gsKMTLFsabjdxtWobRt89f6wrjqfDU4EnRWT7bF37OA=; b=iS4YlxgyLmg+AyuT/ORZGZtp/Uy7nV8EXIsV6tvur08rwKt3cAa3iN8RB/c+/Gczqd nzLNtfaar/0XYO4eM/ytiBcleUYZA2tmLZRvUjKhkEJ2/gNxYO6GBPL8laSAKac/5VSQ NKylejn2Ig76loh/ChpS+K75sU0gs7MkDJL/0vAB1kbu+ZXHuYFij6JOTYljF/4h1Y9/ v9gTPa3TdOP2r+8hCsjIh9Z/RVw7HSzub8P4UDxW2fJk5TEvXt9mvRS3zPAaY4/itflQ FbjCJgjAg9RQubh1awdMwzgFmv4ijUQqAhfoQuvVhXaD/D6bY6utcdewHq3A/bxFDQBW ZKhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724029743; x=1724634543; 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=gsKMTLFsabjdxtWobRt89f6wrjqfDU4EnRWT7bF37OA=; b=DohMv9uIbZuCmZ/AYBJ4XUKxiDgB4VPCb9oqnqpYH1ArN1YWmSGdJXEVlKSYHy95Wm qWDQ47CgetF0OF1QNk1z5oqCbKvNuhk/Ln34q2qjoajG6Bg4Yvefh7WHdUnYEZfOp8P6 IHJjq5fiDBoKoGmGhKYXjCQdI/cZbEEqyBPbchl1XusdCeeVVLSRVOnj6hnuBH4CRPYK iv7ibMvP+0xAVlQWIcXXYsiEMLVCAU1QpND6+4k43JRgsUT2Tcw3GVW8XJ17kzrYElRE WSo7nBBpHQdk1bupTtYlh2rv4yfINSY9RN8wn6u68Ktwds2dfGzAzTVR5cKxlTvuFEWD LK9w== X-Gm-Message-State: AOJu0YzitwILdx3iPLA/hv7FpdXF76QrwNGaHVsfOdmAFZRWRlVoduGY 6ec3RPwXCz9HuGAuaXYwDDJBRH/vSrVzh0dnfZ2Wue/AUWtQWD3izfzEYLYXB5Y= X-Google-Smtp-Source: AGHT+IFDUgQsB68gJvkp+y+h0eUduZ5j/bVcFBQLlDtJ/7kT7CGg1LiqFY+qCCQgQK1MQz9GHHWo0g== X-Received: by 2002:a05:6a00:2e1a:b0:710:e4db:a6fc with SMTP id d2e1a72fcca58-713c52441c9mr12016406b3a.27.1724029743153; Sun, 18 Aug 2024 18:09:03 -0700 (PDT) Received: from localhost.localdomain ([45.63.58.14]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127aef44d6sm5722536b3a.130.2024.08.18.18.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 18:09:02 -0700 (PDT) From: Dongli Si To: sidongli1997@gmail.com Cc: kvm@vger.kernel.org Subject: [PATCH kvmtool 4/4] x86: Disable Topology Extensions on AMD processors in cpuid Date: Mon, 19 Aug 2024 09:08:54 +0800 Message-ID: <20240819010854.13931-1-sidongli1997@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240819010154.13808-1-sidongli1997@gmail.com> References: <20240819010154.13808-1-sidongli1997@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When running guest kernel 6.9 and later on AMD processors, dmesg reports: [ 0.001987] [Firmware Bug]: CPU 1: APIC ID mismatch. CPUID: 0x0000 APIC: 0x0001 This is because kvmtool does not support topoext but does not tell the guest, causing the guest kernel to read the wrong Extended APIC ID. Signed-off-by: Dongli Si --- x86/cpuid.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x86/cpuid.c b/x86/cpuid.c index f4347a8..fd23429 100644 --- a/x86/cpuid.c +++ b/x86/cpuid.c @@ -56,6 +56,9 @@ static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid, int cpu_id) } break; } + case 0x80000001: + entry->ecx &= ~(1 << 22); + break; default: /* Keep the CPUID function as -is */ break;