From patchwork Thu Dec 12 17:29:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BuJ/Ni/8"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhVX74qBz9sNH for ; Fri, 13 Dec 2019 05:03:16 +1100 (AEDT) Received: from localhost ([::1]:35174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSnx-00085V-BB for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:03:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57565) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHA-0005F0-QO for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSH9-0003xy-Oa for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:20 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54257) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSH9-0003wG-Hh for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:19 -0500 Received: by mail-wm1-x342.google.com with SMTP id w8so36614wmd.3 for ; Thu, 12 Dec 2019 09:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=X8qg4vC4u62X+krIpf2n1pZJRXcVq9s/dN9HuyUC68E=; b=BuJ/Ni/8Z0dbYx6aFUpWuzQRETBEy2qWx+fbII5cIRb4kj+NwHwyEda+ex2wWzrybV tYL1YA1z7iCfGD4Yz1oBNyNy/UpNJnDHMiBnQYpY3yHHRik2tC/iFLVhSN6lgE+BVOuP 4Vr+mzYmKijOo5uBMpYYNZTCcNBUUm46o309YQX2XuqurUHSWLvPwfp2UaQRW5OYwyRb Vkb1x9I4NjTdqHpIjyhV8nuLqGA4p2e6WlkPlC2isGjvswMLi8XnVvxevQMGiI75rE04 UfCQKbTXMbL7gczMttJ7z3Lsn4jvYi+pCGLuBUH+F6a+vZOa7UQ4v/upLdoBt2tnOecL gotw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=X8qg4vC4u62X+krIpf2n1pZJRXcVq9s/dN9HuyUC68E=; b=j3atPfjxNVm/Up3D5gl9zlD6Gs9RlwiTzFaEJocYT9roaKXSoxiwm8WCWPvwKimPfN mqIV5BqSTJqFzBc3wBqQjjfSI+Qfprq2PI02CDj43gNoFxTaujhxXUgXUMtD4zmx30d2 fd2APl1fQXHzFDC+i/xLL9vuSZ2AuXMx5WahPNHksQSTT8zcQItb6a0BaukfgX7wz8nt wK6xJVc2nLt1RuHN4KYRmJQz4pJFbrqrRAeNr2mWqNN0JiRIcN+rWU74BV0F8iY6/Br7 0/peESS0gfQCx7gJqiIX89P+bgKdUqLZPs+0zxKo1YjfQ0yy/IbhhOEkzQinbcLBJ8cH 4YYw== X-Gm-Message-State: APjAAAWDa8QWj6K06wBj8acn7CFPtWtHWyMOM2Y/Zf8Y/ZsYasAzacXK 7o/OuAMzBXCYGoVhLyDlmT570meO X-Google-Smtp-Source: APXvYqx55EHdl3/Np2mJPg7qWsig0xTnAfk+a0dcuBs8z3ZLyIEtgac4SmRrubfRxJSHfGGvhJZ0RA== X-Received: by 2002:a1c:286:: with SMTP id 128mr7597351wmc.176.1576171758031; Thu, 12 Dec 2019 09:29:18 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 1/8] i386: conditionally compile more files Date: Thu, 12 Dec 2019 18:29:07 +0100 Message-Id: <1576171754-45138-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/i386/Makefile.objs | 6 +++--- hw/i386/kvm/Makefile.objs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 0d195b5..01ae202 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -1,11 +1,11 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += e820_memory_layout.o multiboot.o obj-y += x86.o -obj-y += pc.o +obj-$(CONFIG_PC) += pc.o pc_sysfw.o obj-$(CONFIG_I440FX) += pc_piix.o obj-$(CONFIG_Q35) += pc_q35.o obj-$(CONFIG_MICROVM) += microvm.o -obj-y += fw_cfg.o pc_sysfw.o +obj-y += fw_cfg.o obj-y += x86-iommu.o obj-$(CONFIG_VTD) += intel_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o @@ -14,4 +14,4 @@ obj-$(CONFIG_VMPORT) += vmport.o obj-$(CONFIG_VMMOUSE) += vmmouse.o obj-y += kvmvapic.o -obj-y += acpi-build.o +obj-$(CONFIG_PC) += acpi-build.o diff --git a/hw/i386/kvm/Makefile.objs b/hw/i386/kvm/Makefile.objs index 4224ed9..0c8d5f2 100644 --- a/hw/i386/kvm/Makefile.objs +++ b/hw/i386/kvm/Makefile.objs @@ -1 +1,5 @@ -obj-y += clock.o apic.o i8259.o ioapic.o i8254.o +obj-y += clock.o +obj-$(CONFIG_APIC) += apic.o +obj-$(CONFIG_IOAPIC) += ioapic.o +obj-$(CONFIG_I8254) += i8254.o +obj-$(CONFIG_I8259) += i8259.o From patchwork Thu Dec 12 17:29:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="idO6K8oE"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhYv0JHyz9sNH for ; Fri, 13 Dec 2019 05:06:11 +1100 (AEDT) Received: from localhost ([::1]:35210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSql-0003HI-B8 for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:06:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57720) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHB-0005GP-Ov for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHA-0003zQ-L8 for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:21 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:34355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHA-0003y5-EC for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:20 -0500 Received: by mail-wr1-x444.google.com with SMTP id t2so3661225wrr.1 for ; Thu, 12 Dec 2019 09:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HsUH1afV9fTj6bRLKgdy/ZlBd4ecIN0MQZ09ZAA7vd4=; b=idO6K8oEq0v5KusymRCXOxJUpNKHvhxHyB8Wo/Dj/XNm7RxnV34dDqu/Ox8NiqpLbP 7ocyutPEiJzZDZXua2vGHh2sZKKZPD1z8qYYoddzWTTAFxYRwcdid+Og06CPC+9eBWWT jGElRk/Hz1mSfCFcsxjD7D+V1XILnewZM5XkZtYKE7JBBk1JW20Hub3SW18XOTKhj+BY Y4HZFciQNYJIKGC+nRR/Fc5O+JKrn1M+lxHZy9g01gvExImQ0oAJRO8dgYiHWZbUkGbG nJNSseqaUZVUTkGiVfao7BhAEH8jqAwi4jxpnq64q/QmSaKuGWWRPxAsg3BK7pAva2Dp NDqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HsUH1afV9fTj6bRLKgdy/ZlBd4ecIN0MQZ09ZAA7vd4=; b=Sj0jOrG4Cnu/j/RPUwc+IQFOWgYnCayQyfZ+hNYlqpyHoEFi6O51EMgFjTG0hvMFMl dcrVB0D1jH7WODr0SRhLEu5VVCRf4KgROYKPF9IG6xGNKh3L6ptbBbPDi5uM4IQ/ba6J ILIXP1VjXWnaNFdETtNGyaR+8PctHDcJEeYa75jG0IGU7FjZW3d28E0AN3enyuCI9B6U jNo0GyNtRnODPYxli4hN2fLInbV3xOlI1WxgqPAOmlh9zZBwsG8U42SAJyjHqBWg1Bpk CAJbBoUtlxAOL4MgQ/zAxKRCLWxhN1QycNpLc5Q9q4xL7HAISzsIWnw7kiDPKAQy8NIc qCAg== X-Gm-Message-State: APjAAAWmDcz7frmkbTowJQLtITnAQ8hz5t4+wDhD7Lpy5oF0cjJMqLgk 6s5Q1geAIpQqNvDRYJWd7w7ygwXS X-Google-Smtp-Source: APXvYqz5rT5jTJZ6KnBGysaCC+7ysy1uq/6+3SW5zeg0y6e+Wy3yzwZaZ8C68T9CZRGb3oqfB42tdA== X-Received: by 2002:adf:f103:: with SMTP id r3mr7342824wro.295.1576171759139; Thu, 12 Dec 2019 09:29:19 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 2/8] fw_cfg: allow building without other devices Date: Thu, 12 Dec 2019 18:29:08 +0100 Message-Id: <1576171754-45138-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The microvm machine type uses fw_cfg but lacks SMBIOS and ACPI. Do not include the files if the symbol is not present in QEMU and remove dependencies on machine-specific files. Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/i386/fw_cfg.c | 7 +++++++ hw/i386/pc.c | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 39b6bc6..326e33e 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -22,6 +22,9 @@ #include "hw/nvram/fw_cfg.h" #include "e820_memory_layout.h" #include "kvm_i386.h" +#include "config-devices.h" + +struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; const char *fw_cfg_arch_key_name(uint16_t key) { @@ -46,6 +49,7 @@ const char *fw_cfg_arch_key_name(uint16_t key) void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) { +#ifdef CONFIG_SMBIOS uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; struct smbios_phys_mem_area *mem_array; @@ -83,6 +87,7 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", smbios_anchor, smbios_anchor_len); } +#endif } FWCfgState *fw_cfg_arch_create(MachineState *ms, @@ -114,8 +119,10 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, */ fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); +#ifdef CONFIG_ACPI fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, acpi_tables, acpi_tables_len); +#endif fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b9f3b38..3d2c5d8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -101,8 +101,6 @@ #define DPRINTF(fmt, ...) #endif -struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; - GlobalProperty pc_compat_4_1[] = {}; const size_t pc_compat_4_1_len = G_N_ELEMENTS(pc_compat_4_1); From patchwork Thu Dec 12 17:29:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AiCZnfSH"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhzJ3103z9sPc for ; Fri, 13 Dec 2019 05:24:44 +1100 (AEDT) Received: from localhost ([::1]:35654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifT8j-0002C7-2B for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:24:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHE-0005K0-4X for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHB-00041k-VM for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:23 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:42487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHB-00040F-N6 for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:21 -0500 Received: by mail-wr1-x441.google.com with SMTP id q6so3602862wro.9 for ; Thu, 12 Dec 2019 09:29:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PDm0yyqvXq+OhmvJ72i1vFG6mZGav2pTUkONp23jxeo=; b=AiCZnfSH1LK8xZxZyopqgaQL0/uU4ETuq7E3i/f5c6Jsx9E7QOdWEJ0Y1fUt2kWimm tBsJsvI/lL+gwkKJ8OLw2KtSDdtBnAzi9DMr7K9YThugMOgFsiuy0sfuviWE63AJfAuv nQPmXhJ6Z5nXsipRZZeG0R+NY/C1jY6aO4pmQu0dhN2BJyJVXM4pudNjB9wR1ihC3zZt RupxY/t4dOWH9ygY9xqeYS5gHoOCWERnhd04FnnP2cxv3dHL65W6+RRyS5caumZQEzB9 2D8Jjsv2AjnNLlDrYamnCFLxGbiiMERPJITfwz4/kcCuyCJQieZ4S3uVK5Xuf4hYPJoY HvfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=PDm0yyqvXq+OhmvJ72i1vFG6mZGav2pTUkONp23jxeo=; b=f/0dV6B+Ak4vvi5RpSFmFQMETlrxV6yNnidQj3iOzWW27MGWJ9RQxsznjuvxPUPA+k 27LFCGw7wCD5arGIHlYWik2aSOQhfLFefof+mjyIS9m1KoONLXBBFiPnLA6Cahft6Zrp 7wuUC/Bk8D4ncHONvsggnHf9V6QF5ZrcKh0aOvRAYlW3BSlBqpWokUE4rgrpzwf96BS/ sbX7xp1K5oyIFTqqfHPATbz7LTkNC3bkyFnuQ2tPKcUj9YFFEzqmUKPltf7KYBr3jZN6 0PHCfe/+Ca+W7Acx7F8+YQVAHVieP6JFupQ21GoE0JzgggdPLP1qrGGpFJQbr3sqdGF2 bUsg== X-Gm-Message-State: APjAAAU8efoKWPzG7ycvP0ksbOmfvLYBFh+1gDxt7DsZg7BJF+/EJMPV lYoXXE0GKAVr9GJNK9UkJrdF6i/o X-Google-Smtp-Source: APXvYqwm/clmaDCJwlpZHEiemnIZ1sBBN3HiD/7G+Rp0MB5Zhgr1OBg9w9XeeToJ57FDEiFDj22KmA== X-Received: by 2002:adf:9b83:: with SMTP id d3mr7605358wrc.54.1576171760145; Thu, 12 Dec 2019 09:29:20 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 3/8] hw: replace hw/i386/pc.h with a header just for the i8259 Date: Thu, 12 Dec 2019 18:29:09 +0100 Message-Id: <1576171754-45138-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove the need to include i386/pc.h to get to the i8259 functions. This is enough to remove the inclusion of hw/i386/pc.h from all non-x86 files. Signed-off-by: Paolo Bonzini --- hw/alpha/alpha_sys.h | 3 ++- hw/alpha/dp264.c | 1 + hw/hppa/hppa_sys.h | 3 ++- hw/hppa/machine.c | 1 + hw/i386/kvm/i8259.c | 1 + hw/i386/microvm.c | 1 + hw/i386/pc.c | 1 + hw/i386/x86.c | 1 + hw/input/pckbd.c | 1 - hw/intc/Kconfig | 2 ++ hw/intc/apic.c | 2 +- hw/intc/i8259.c | 2 +- hw/intc/i8259_common.c | 2 +- hw/intc/ioapic.c | 3 ++- hw/isa/i82378.c | 2 +- hw/isa/lpc_ich9.c | 1 - hw/isa/piix4.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_r4k.c | 2 +- hw/pci-host/bonito.c | 1 - hw/pci-host/prep.c | 2 +- include/hw/i386/pc.h | 8 -------- include/hw/intc/i8259.h | 12 ++++++++++++ include/hw/isa/i8259_internal.h | 2 +- target/i386/monitor.c | 1 - 27 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 include/hw/intc/i8259.h diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h index 4e127a6..95033d7 100644 --- a/hw/alpha/alpha_sys.h +++ b/hw/alpha/alpha_sys.h @@ -7,7 +7,8 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4], diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 4320497..5ed9a5a 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -20,6 +20,7 @@ #include "hw/timer/i8254.h" #include "hw/isa/superio.h" #include "hw/dma/i8257.h" +#include "net/net.h" #include "qemu/cutils.h" #define MAX_IDE_BUS 2 diff --git a/hw/hppa/hppa_sys.h b/hw/hppa/hppa_sys.h index 43d25d2..4e50196 100644 --- a/hw/hppa/hppa_sys.h +++ b/hw/hppa/hppa_sys.h @@ -6,7 +6,8 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" #include "hppa_hardware.h" diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index b30aba6..5d0de26 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -19,6 +19,7 @@ #include "hppa_sys.h" #include "qemu/units.h" #include "qapi/error.h" +#include "net/net.h" #include "qemu/log.h" #define MAX_IDE_BUS 2 diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index d0c1b1d..e404fdc 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/isa/i8259_internal.h" +#include "hw/intc/i8259.h" #include "qemu/module.h" #include "hw/i386/apic_internal.h" #include "hw/irq.h" diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index def37e6..2068319 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -34,6 +34,7 @@ #include "hw/i386/x86.h" #include "hw/i386/pc.h" #include "target/i386/cpu.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" #include "hw/char/serial.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3d2c5d8..fdbd2bf 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -44,6 +44,7 @@ #include "migration/vmstate.h" #include "multiboot.h" #include "hw/rtc/mc146818rtc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/input/i8042.h" diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 394edc2..3e4aee5 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -39,6 +39,7 @@ #include "target/i386/cpu.h" #include "hw/i386/topology.h" #include "hw/i386/fw_cfg.h" +#include "hw/intc/i8259.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/nmi.h" diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index f0acfd8..2f09f78 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -26,7 +26,6 @@ #include "qemu/log.h" #include "hw/isa/isa.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/input/ps2.h" #include "hw/irq.h" #include "hw/input/i8042.h" diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 5347f84..10a680b 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -9,6 +9,7 @@ config PL190 config IOAPIC bool + select I8259 config ARM_GIC bool @@ -21,6 +22,7 @@ config OPENPIC config APIC bool select MSI_NONBROKEN + select I8259 config ARM_GIC_KVM bool diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 2a74f7b..bd40467 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -22,10 +22,10 @@ #include "hw/i386/apic_internal.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "qemu/host-utils.h" #include "trace.h" -#include "hw/i386/pc.h" #include "hw/i386/apic-msidef.h" #include "qapi/error.h" diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index 211a989..51b27f6 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -23,7 +23,7 @@ */ #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "qemu/timer.h" diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index bd37bb5..e7b1a10 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -24,7 +24,7 @@ */ #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/isa/i8259_internal.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index ead14e1..4f55776 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -23,10 +23,11 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" #include "hw/i386/ioapic_internal.h" +#include "hw/i386/x86.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "hw/qdev-properties.h" #include "sysemu/kvm.h" diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index de276cd..dcb6b47 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -19,8 +19,8 @@ #include "qemu/osdep.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "migration/vmstate.h" #include "hw/audio/pcspk.h" diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 17c292e..170792a 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -35,7 +35,6 @@ #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i386/ioapic.h" diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 86678e6..7edec5e 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -26,11 +26,11 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/irq.h" -#include "hw/i386/pc.h" #include "hw/southbridge/piix.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index f1af840..b2ea13f 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -30,7 +30,7 @@ #include "hw/pci/pci_host.h" #include "hw/southbridge/piix.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "exec/address-spaces.h" #include "trace.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 55c143e..6199c54 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,7 +23,7 @@ #include "qemu/units.h" #include "qapi/error.h" #include "cpu.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/isa/superio.h" #include "net/net.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index d978bb6..c40b23f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -26,7 +26,7 @@ #include "qemu-common.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 7002423..fbbd59e 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -15,7 +15,7 @@ #include "cpu.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "net/net.h" diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index ceee463..c924007 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -40,7 +40,6 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/mips/mips.h" #include "hw/pci/pci_host.h" diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 85d7ba9..afa136d 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -32,7 +32,7 @@ #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/loader.h" #include "hw/or-irq.h" diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1f86eba..82447f8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -134,14 +134,6 @@ typedef struct PCMachineClass { #define PC_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) -/* i8259.c */ - -extern DeviceState *isa_pic; -qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); -qemu_irq *kvm_i8259_init(ISABus *bus); -int pic_read_irq(DeviceState *d); -int pic_get_output(DeviceState *d); - /* ioapic.c */ /* Global System Interrupts */ diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h new file mode 100644 index 0000000..e2b1e8c --- /dev/null +++ b/include/hw/intc/i8259.h @@ -0,0 +1,12 @@ +#ifndef HW_I8259_H +#define HW_I8259_H + +/* i8259.c */ + +extern DeviceState *isa_pic; +qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); +qemu_irq *kvm_i8259_init(ISABus *bus); +int pic_get_output(DeviceState *d); +int pic_read_irq(DeviceState *d); + +#endif diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h index ee189e4..861d70d 100644 --- a/include/hw/isa/i8259_internal.h +++ b/include/hw/isa/i8259_internal.h @@ -25,9 +25,9 @@ #ifndef QEMU_I8259_INTERNAL_H #define QEMU_I8259_INTERNAL_H -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "hw/intc/intc.h" +#include "hw/intc/i8259.h" typedef struct PICCommonState PICCommonState; diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 9fb4d64..27ebfa3 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,7 +28,6 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" From patchwork Thu Dec 12 17:29:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JUIbLF3s"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhwB4GX4z9sNH for ; Fri, 13 Dec 2019 05:22:00 +1100 (AEDT) Received: from localhost ([::1]:35598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifT64-0006yO-UQ for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:21:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58105) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHE-0005Jt-1L for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHC-00043P-VG for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:23 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42490) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHC-00042H-NJ for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:22 -0500 Received: by mail-wr1-x444.google.com with SMTP id q6so3602936wro.9 for ; Thu, 12 Dec 2019 09:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=U3vOKBgC/i6K4YScuB6kA+GIuvMW8sSGRrxjWYPsniE=; b=JUIbLF3sasHweeFUwYx+n6HAXX/gtL+eF5oXBA4MFHSuUfx/omfDZ0P6yADcrDkdNh VTJr6b++ukm7AJ76O+zdniasm3U4A9Scetms2oUEdMB3S9Pr4C3cX0WGQZDIzpLBLGfV VcE0b7DC6zbF3G6rijnHFS4MRL86jbpE3FXtEKBXlN0Gg8+ZyY6rim8oAunCstYAtCO9 oEo7wIKwRj8OHrcWCH7Aj3FQ19/yCSjLwJmMSJRCZMJt8gtztIMhukIVJSIe/7gT9swo pQMLCLfHgJ5Tcv4J0TilcV04VWLYRxurqBud6It+1sjpHqMVf6wWFAB8Qh+HTr8h/M0q yVSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=U3vOKBgC/i6K4YScuB6kA+GIuvMW8sSGRrxjWYPsniE=; b=ez0iQSJxJDMox+J0gkIZOgDVOFqlhLrJVgsamd1HjwF4v8EAMjmDl/oas+aR7EnM+8 K1a/+ykveKw/1v12tR2t/UzpOODxEw8+uhVMmqpaBTMNx1xxIhWN30r5FRjf+J4UDFPe WEAL4dTtGvvSnw0kfzUGczg5R6wVKwfwoMpaZe2ibwlsPwrcjgW2rg3XiXGlC4i1tHzz yuUZWDq8gPCcyN/B+MiMSyAfvfOafAg7TwIUxWeQunE+zr2v6/XWfh0jBHkYz34BbrYF OwWnWCBKXizAz7cDvjPHQm3aYM8F7e0hLrpj/MCy4JetY4d9kdhoiBXHtqGupAPtBDRS p5Ww== X-Gm-Message-State: APjAAAVx5vGIEFQicqkft1Xuwx3VGcfI5x/sqEsCjeLVdeZi8SfhDF+n LBnqbL7Cq4lv1F4oYdf83H3XEUll X-Google-Smtp-Source: APXvYqzvWRVXpPKifLV+b+mzlZ2uJLjX/njBYsU+a+7ZS+05I2jyqHG6dVo9OQLOEkPXSq1GOa34Kg== X-Received: by 2002:adf:9427:: with SMTP id 36mr7572003wrq.166.1576171761522; Thu, 12 Dec 2019 09:29:21 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 4/8] pci-stub: add more MSI functions Date: Thu, 12 Dec 2019 18:29:10 +0100 Message-Id: <1576171754-45138-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" On x86, KVM needs some function from the PCI subsystem in order to set up interrupt routes. Provide some stubs to support x86 machines that lack PCI. Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/pci/pci-stub.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index c04a5df..cc2a2e1 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -26,6 +26,7 @@ #include "qapi/qmp/qerror.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" +#include "hw/pci/msix.h" bool msi_nonbroken; bool pci_available; @@ -64,3 +65,29 @@ void msi_notify(PCIDevice *dev, unsigned int vector) { g_assert_not_reached(); } + +/* Required by target/i386/kvm.c */ +bool msi_is_masked(const PCIDevice *dev, unsigned vector) +{ + g_assert_not_reached(); +} + +MSIMessage msi_get_message(PCIDevice *dev, unsigned int vector) +{ + g_assert_not_reached(); +} + +int msix_enabled(PCIDevice *dev) +{ + return false; +} + +bool msix_is_masked(PCIDevice *dev, unsigned vector) +{ + g_assert_not_reached(); +} + +MSIMessage msix_get_message(PCIDevice *dev, unsigned int vector) +{ + g_assert_not_reached(); +} From patchwork Thu Dec 12 17:29:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sVmTsolc"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Yhcj3bXYz9sR7 for ; Fri, 13 Dec 2019 05:08:37 +1100 (AEDT) Received: from localhost ([::1]:35297 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSt5-0006vv-Cp for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:08:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58460) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHF-0005Me-St for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHE-00045k-61 for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:25 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:40204) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHD-000446-V1 for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:24 -0500 Received: by mail-wr1-x442.google.com with SMTP id c14so3620879wrn.7 for ; Thu, 12 Dec 2019 09:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KD+mFGQOMXFzU8I/K2R4asx9z8KYJwXRgxxZ/YYLUss=; b=sVmTsolczJ9zN/z70nd9VzLDO179vQ64PMWjHIg4VBNSVm2StcQOYl8p+kV2flDGO4 Bw71L+7biI0cOO/UEJiHPqfBQqcbj8qmYNFJFF7FcsRmGmkO+8tZwNVVdxLIiZz7v5+k xu+uoTdeX5BuBpGOZWZ1PvzqhGZIqnQD4cix9V+5bYRPNJqcegutYvlDNUdbyC/Li71G gGJ9WK/SgSW0Coczyea35W8q408cGrxacpxNSffiyAw3RhAS2Aa3JBO1O6gboKyxblSB o+I1ZZi0siwhFDpn/8f7RvGxKP3j2RY2gpYBXPXVKkJf/tvk5HWkhALyVKgl8XRFullV I+Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KD+mFGQOMXFzU8I/K2R4asx9z8KYJwXRgxxZ/YYLUss=; b=CytWH0BzN+Hgh9Os0NAWQaumRPLWujo+AfU21qWFYdHMtF5r5jT02XLq0hj37p8n7n LWIk9EhZLwuE2q9ZDu+L6jMavwleEsl83PkS2Mh8EHH9kxabzZ6vmA4NO3sviX4E4oJv xHOw7NXfM7Gc53xS33HZQWGtsdaBbpMzYNPGKzF7Reg0dbKB2M923d0QYLaIxsWjD/ii UZvqIg56/g5EeTDpViwOC/Er6npD2l1FiowDTznm6FuLzkPfeMgWhBigOi+TlYLFvE49 UWej/L/gcCgmih9Gk3R4BPvrc+w+88zkaOPUdn91SrxJSnwvu8a1HOngRwPmUXxEV2w5 Seog== X-Gm-Message-State: APjAAAWCbe96Kw2bgLnwSEPrqXF0KzKqEeE5A3xXwjB3rN3hGDhcVL6G 41kM8I011cue+gWr4XoKDwjCLk+h X-Google-Smtp-Source: APXvYqzwQuZmUlYutbciprbepII72jEx3wIqH/YVUnSVvrvI8IIArsAcO92ed8LO95t9pg14f4WqIw== X-Received: by 2002:a05:6000:149:: with SMTP id r9mr7531290wrx.147.1576171762477; Thu, 12 Dec 2019 09:29:22 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 5/8] x86: move SMM property to X86MachineState Date: Thu, 12 Dec 2019 18:29:11 +0100 Message-Id: <1576171754-45138-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add it to microvm as well, it is a generic property of the x86 architecture. Suggested-by: Sergio Lopez Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 49 ------------------------------------------------- hw/i386/pc_piix.c | 6 +++--- hw/i386/pc_q35.c | 2 +- hw/i386/x86.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- include/hw/i386/pc.h | 3 --- include/hw/i386/x86.h | 5 +++++ target/i386/kvm.c | 3 +-- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index fdbd2bf..6a3212e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2028,48 +2028,6 @@ static void pc_machine_set_vmport(Object *obj, Visitor *v, const char *name, visit_type_OnOffAuto(v, name, &pcms->vmport, errp); } -bool pc_machine_is_smm_enabled(PCMachineState *pcms) -{ - bool smm_available = false; - - if (pcms->smm == ON_OFF_AUTO_OFF) { - return false; - } - - if (tcg_enabled() || qtest_enabled()) { - smm_available = true; - } else if (kvm_enabled()) { - smm_available = kvm_has_smm(); - } - - if (smm_available) { - return true; - } - - if (pcms->smm == ON_OFF_AUTO_ON) { - error_report("System Management Mode not supported by this hypervisor."); - exit(1); - } - return false; -} - -static void pc_machine_get_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - OnOffAuto smm = pcms->smm; - - visit_type_OnOffAuto(v, name, &smm, errp); -} - -static void pc_machine_set_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCMachineState *pcms = PC_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &pcms->smm, errp); -} - static bool pc_machine_get_smbus(Object *obj, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); @@ -2116,7 +2074,6 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); - pcms->smm = ON_OFF_AUTO_AUTO; #ifdef CONFIG_VMPORT pcms->vmport = ON_OFF_AUTO_AUTO; #else @@ -2223,12 +2180,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_get_device_memory_region_size, NULL, NULL, NULL, &error_abort); - object_class_property_add(oc, PC_MACHINE_SMM, "OnOffAuto", - pc_machine_get_smm, pc_machine_set_smm, - NULL, NULL, &error_abort); - object_class_property_set_description(oc, PC_MACHINE_SMM, - "Enable SMM (pc & q35)", &error_abort); - object_class_property_add(oc, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1bd70d1..dd0f00e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -281,7 +281,7 @@ else { /* TODO: Populate SPD eeprom data. */ pcms->smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, x86ms->gsi[9], smi_irq, - pc_machine_is_smm_enabled(pcms), + x86_machine_is_smm_enabled(x86ms), &piix4_pm); smbus_eeprom_init(pcms->smbus, 8, NULL, 0); @@ -309,9 +309,9 @@ else { static void pc_compat_2_3_fn(MachineState *machine) { - PCMachineState *pcms = PC_MACHINE(machine); + X86MachineState *x86ms = X86_MACHINE(machine); if (kvm_enabled()) { - pcms->smm = ON_OFF_AUTO_OFF; + x86ms->smm = ON_OFF_AUTO_OFF; } } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 385e5cf..bccaaee 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -276,7 +276,7 @@ static void pc_q35_init(MachineState *machine) 0xff0104); /* connect pm stuff to lpc */ - ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms)); + ich9_lpc_pm_init(lpc, x86_machine_is_smm_enabled(x86ms)); if (pcms->sata_enabled) { /* ahci and SATA device, for q35 1 ahci controller is built-in */ diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 3e4aee5..6fb01e4 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -746,10 +746,53 @@ static void x86_machine_set_max_ram_below_4g(Object *obj, Visitor *v, x86ms->max_ram_below_4g = value; } +bool x86_machine_is_smm_enabled(X86MachineState *x86ms) +{ + bool smm_available = false; + + if (x86ms->smm == ON_OFF_AUTO_OFF) { + return false; + } + + if (tcg_enabled() || qtest_enabled()) { + smm_available = true; + } else if (kvm_enabled()) { + smm_available = kvm_has_smm(); + } + + if (smm_available) { + return true; + } + + if (x86ms->smm == ON_OFF_AUTO_ON) { + error_report("System Management Mode not supported by this hypervisor."); + exit(1); + } + return false; +} + +static void x86_machine_get_smm(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms = X86_MACHINE(obj); + OnOffAuto smm = x86ms->smm; + + visit_type_OnOffAuto(v, name, &smm, errp); +} + +static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms = X86_MACHINE(obj); + + visit_type_OnOffAuto(v, name, &x86ms->smm, errp); +} + static void x86_machine_initfn(Object *obj) { X86MachineState *x86ms = X86_MACHINE(obj); + x86ms->smm = ON_OFF_AUTO_AUTO; x86ms->max_ram_below_4g = 0; /* use default */ x86ms->smp_dies = 1; } @@ -770,9 +813,14 @@ static void x86_machine_class_init(ObjectClass *oc, void *data) object_class_property_add(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "size", x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); - object_class_property_set_description(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); + + object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", + x86_machine_get_smm, x86_machine_set_smm, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, X86_MACHINE_SMM, + "Enable SMM", &error_abort); } static const TypeInfo x86_machine_info = { diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 82447f8..ca641e8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -43,7 +43,6 @@ struct PCMachineState { /* Configuration options: */ OnOffAuto vmport; - OnOffAuto smm; bool acpi_build_enabled; bool smbus_enabled; @@ -61,7 +60,6 @@ struct PCMachineState { #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" #define PC_MACHINE_VMPORT "vmport" -#define PC_MACHINE_SMM "smm" #define PC_MACHINE_SMBUS "smbus" #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" @@ -165,7 +163,6 @@ void vmmouse_set_data(const uint32_t *data); /* pc.c */ extern int fd_bootchk; -bool pc_machine_is_smm_enabled(PCMachineState *pcms); void pc_acpi_smi_interrupt(void *opaque, int irq, int level); void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp); diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 4b84917..97d1575 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -60,6 +60,8 @@ typedef struct { uint16_t boot_cpus; unsigned smp_dies; + OnOffAuto smm; + /* * Address space used by IOAPIC device. All IOAPIC interrupts * will be translated to MSI messages in the address space. @@ -68,6 +70,7 @@ typedef struct { } X86MachineState; #define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" +#define X86_MACHINE_SMM "smm" #define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86") #define X86_MACHINE(obj) \ @@ -95,4 +98,6 @@ void x86_load_linux(X86MachineState *x86ms, bool pvh_enabled, bool linuxboot_dma_enabled); +bool x86_machine_is_smm_enabled(X86MachineState *x86ms); + #endif diff --git a/target/i386/kvm.c b/target/i386/kvm.c index ef63f3a..c7ff67a 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2173,8 +2173,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } if (kvm_check_extension(s, KVM_CAP_X86_SMM) && - object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE) && - pc_machine_is_smm_enabled(PC_MACHINE(ms))) { + x86_machine_is_smm_enabled(X86_MACHINE(ms))) { smram_machine_done.notify = register_smram_listener; qemu_add_machine_init_done_notifier(&smram_machine_done); } From patchwork Thu Dec 12 17:29:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Gk7jx8bg"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Yj0K5JMfz9sR4 for ; Fri, 13 Dec 2019 05:25:37 +1100 (AEDT) Received: from localhost ([::1]:35672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifT9b-0003dq-1x for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:25:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58756) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHH-0005PO-JE for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHF-00047s-CU for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:27 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHF-00046L-3m for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:25 -0500 Received: by mail-wm1-x342.google.com with SMTP id a5so3272573wmb.0 for ; Thu, 12 Dec 2019 09:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XZyx9IFo+SVuB7CJJCU4PRrLmaZiUFG16v3dHoMQqKc=; b=Gk7jx8bgsRQg2LpMcPkhMMjU6HXsCWlD4PRCtaKgpHofUdrfloRNcJHbB7a5W18WDv Z2S7IMu5feJib8nS1yzGC6EsIh8MIX4G3n6xitG+/UPlpcRs2tXpvfYoaKEbXmCjIiC6 rBZHJ16ygA4IXzCPwbY807AJ761dZxcQgCHGfh1CuBKi/dPudz/HP5lZTsr59lDdC0nP G98n1Dx+uMyqMN8IcGoCzI9TK5CpJPrvW2Vm+n0B7MFc1Q03JEOzeK9JVX3UkVzM86bX 53eHre568SLqElgOoxEttdFifxB/MxGxP+Amlkj+tymuKxZo3uSHGx2dhA14/Z28lu2Y hxYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=XZyx9IFo+SVuB7CJJCU4PRrLmaZiUFG16v3dHoMQqKc=; b=kMmlMxKNOUl1xnw1UzCVSvy2oA/M2T/SSRhXRKxmXgwxyjOvKcs/h0ExfFdd2CpP+I qhSdA8zo+0MxpjW5KOy8PL1mzPr+LIjruVVfaVN3/vB0X3C/8YHfCQtY19p+dDRgYiOP oTLxtkKLkhKhWsmBXnBj06KBbeXDFjTdsKoIi4GT/v3WCtNYL6sf6KC2YUW4gyJhXr7g jxNQBRkwriOnqu+h0eD0Dp+Zqc+wQRAL91OmTy1MnFqo9IoBuNBXjHm4MaF5iFYPnn4M E10cApmOrC36eHPI58TEfCwYPmiFIFW3gdrJTROocJ/YesRZ72GcQE5yb265SNOJrvm9 tMbA== X-Gm-Message-State: APjAAAXdV7vpqypnPn04oCBfF+ndGbKiUblOheF4DkJoMM7AurHzFaNv Cwyfc565fNmJ60N3RDFpmHlPt4jD X-Google-Smtp-Source: APXvYqxRaMblsWrX08tTad4OQJibIdo2Q+zf+bPwHKHmCJBnMfaXNfoLGi2mTrmEz084i/Vqbj8Ejg== X-Received: by 2002:a1c:f404:: with SMTP id z4mr7557037wma.12.1576171763480; Thu, 12 Dec 2019 09:29:23 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 6/8] x86: move more x86-generic functions out of PC files Date: Thu, 12 Dec 2019 18:29:12 +0100 Message-Id: <1576171754-45138-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These are needed by microvm too, so move them outside of PC-specific files. With this patch, microvm.c need not include pc.h anymore. Signed-off-by: Paolo Bonzini --- hw/i386/acpi-build.c | 1 + hw/i386/fw_cfg.c | 1 - hw/i386/fw_cfg.h | 2 + hw/i386/kvm/ioapic.c | 2 +- hw/i386/microvm.c | 3 +- hw/i386/pc.c | 101 +------------------------------------------------- hw/i386/x86.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/i386/pc.h | 20 ---------- include/hw/i386/x86.h | 18 +++++++++ target/i386/kvm.c | 2 +- target/i386/machine.c | 2 +- 11 files changed, 126 insertions(+), 126 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 12ff55f..7b8da62 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -53,6 +53,7 @@ /* Supported chipsets: */ #include "hw/southbridge/piix.h" #include "hw/acpi/pcihp.h" +#include "hw/i386/fw_cfg.h" #include "hw/i386/ich9.h" #include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h" diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 326e33e..da60ada 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -16,7 +16,6 @@ #include "sysemu/numa.h" #include "hw/acpi/acpi.h" #include "hw/firmware/smbios.h" -#include "hw/i386/pc.h" #include "hw/i386/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/nvram/fw_cfg.h" diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index e0856a3..9e74278 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -12,6 +12,8 @@ #include "hw/boards.h" #include "hw/nvram/fw_cfg.h" +#define FW_CFG_IO_BASE 0x510 + #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index f94729c..8703f19 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -12,7 +12,7 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/i386/ioapic_internal.h" diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 2068319..827ce29 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -32,7 +32,6 @@ #include "hw/kvm/clock.h" #include "hw/i386/microvm.h" #include "hw/i386/x86.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "hw/intc/i8259.h" #include "hw/timer/i8254.h" @@ -133,7 +132,7 @@ static void microvm_devices_init(MicrovmMachineState *mms) if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) { qemu_irq *i8259; - i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); + i8259 = i8259_init(isa_bus, x86_allocate_cpu_irq()); for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6a3212e..545b855 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -343,17 +343,6 @@ GlobalProperty pc_compat_1_4[] = { }; const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4); -void gsi_handler(void *opaque, int n, int level) -{ - GSIState *s = opaque; - - DPRINTF("pc: %s GSI %d\n", level ? "raising" : "lowering", n); - if (n < ISA_NUM_IRQS) { - qemu_set_irq(s->i8259_irq[n], level); - } - qemu_set_irq(s->ioapic_irq[n], level); -} - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) { GSIState *s; @@ -393,55 +382,6 @@ static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size) return 0xffffffffffffffffULL; } -/* TSC handling */ -uint64_t cpu_get_tsc(CPUX86State *env) -{ - return cpu_get_ticks(); -} - -/* IRQ handling */ -int cpu_get_pic_interrupt(CPUX86State *env) -{ - X86CPU *cpu = env_archcpu(env); - int intno; - - if (!kvm_irqchip_in_kernel()) { - intno = apic_get_interrupt(cpu->apic_state); - if (intno >= 0) { - return intno; - } - /* read the irq from the PIC */ - if (!apic_accept_pic_intr(cpu->apic_state)) { - return -1; - } - } - - intno = pic_read_irq(isa_pic); - return intno; -} - -static void pic_irq_request(void *opaque, int irq, int level) -{ - CPUState *cs = first_cpu; - X86CPU *cpu = X86_CPU(cs); - - DPRINTF("pic_irqs: %s irq %d\n", level? "raise" : "lower", irq); - if (cpu->apic_state && !kvm_irqchip_in_kernel()) { - CPU_FOREACH(cs) { - cpu = X86_CPU(cs); - if (apic_accept_pic_intr(cpu->apic_state)) { - apic_deliver_pic_intr(cpu->apic_state, level); - } - } - } else { - if (level) { - cpu_interrupt(cs, CPU_INTERRUPT_HARD); - } else { - cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); - } - } -} - /* PC cmos mappings */ #define REG_EQUIPMENT_BYTE 0x14 @@ -885,16 +825,6 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) nb_ne2k++; } -DeviceState *cpu_get_current_apic(void) -{ - if (current_cpu) { - X86CPU *cpu = X86_CPU(current_cpu); - return cpu->apic_state; - } else { - return NULL; - } -} - void pc_acpi_smi_interrupt(void *opaque, int irq, int level) { X86CPU *cpu = opaque; @@ -1290,11 +1220,6 @@ uint64_t pc_pci_hole64_start(void) return ROUND_UP(hole64_start, 1 * GiB); } -qemu_irq pc_allocate_cpu_irq(void) -{ - return qemu_allocate_irq(pic_irq_request, NULL, 0); -} - DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus) { DeviceState *dev = NULL; @@ -1471,7 +1396,7 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs) } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { - i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); + i8259 = i8259_init(isa_bus, x86_allocate_cpu_irq()); } for (size_t i = 0; i < ISA_NUM_IRQS; i++) { @@ -1481,30 +1406,6 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs) g_free(i8259); } -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) -{ - DeviceState *dev; - SysBusDevice *d; - unsigned int i; - - if (kvm_ioapic_in_kernel()) { - dev = qdev_create(NULL, TYPE_KVM_IOAPIC); - } else { - dev = qdev_create(NULL, TYPE_IOAPIC); - } - if (parent_name) { - object_property_add_child(object_resolve_path(parent_name, NULL), - "ioapic", OBJECT(dev), NULL); - } - qdev_init_nofail(dev); - d = SYS_BUS_DEVICE(dev); - sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); - - for (i = 0; i < IOAPIC_NUM_PINS; i++) { - gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); - } -} - static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 6fb01e4..b14acca 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -42,11 +42,14 @@ #include "hw/intc/i8259.h" #include "hw/acpi/cpu_hotplug.h" +#include "hw/irq.h" #include "hw/nmi.h" #include "hw/loader.h" #include "multiboot.h" #include "elf.h" #include "standard-headers/asm-x86/bootparam.h" +#include "config-devices.h" +#include "kvm_i386.h" #define BIOS_FILENAME "bios.bin" @@ -221,6 +224,103 @@ static long get_file_size(FILE *f) return size; } +/* TSC handling */ +uint64_t cpu_get_tsc(CPUX86State *env) +{ + return cpu_get_ticks(); +} + +/* IRQ handling */ +static void pic_irq_request(void *opaque, int irq, int level) +{ + CPUState *cs = first_cpu; + X86CPU *cpu = X86_CPU(cs); + + if (cpu->apic_state && !kvm_irqchip_in_kernel()) { + CPU_FOREACH(cs) { + cpu = X86_CPU(cs); + if (apic_accept_pic_intr(cpu->apic_state)) { + apic_deliver_pic_intr(cpu->apic_state, level); + } + } + } else { + if (level) { + cpu_interrupt(cs, CPU_INTERRUPT_HARD); + } else { + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); + } + } +} + +qemu_irq x86_allocate_cpu_irq(void) +{ + return qemu_allocate_irq(pic_irq_request, NULL, 0); +} + +int cpu_get_pic_interrupt(CPUX86State *env) +{ + X86CPU *cpu = env_archcpu(env); + int intno; + + if (!kvm_irqchip_in_kernel()) { + intno = apic_get_interrupt(cpu->apic_state); + if (intno >= 0) { + return intno; + } + /* read the irq from the PIC */ + if (!apic_accept_pic_intr(cpu->apic_state)) { + return -1; + } + } + + intno = pic_read_irq(isa_pic); + return intno; +} + +DeviceState *cpu_get_current_apic(void) +{ + if (current_cpu) { + X86CPU *cpu = X86_CPU(current_cpu); + return cpu->apic_state; + } else { + return NULL; + } +} + +void gsi_handler(void *opaque, int n, int level) +{ + GSIState *s = opaque; + + if (n < ISA_NUM_IRQS) { + qemu_set_irq(s->i8259_irq[n], level); + } + qemu_set_irq(s->ioapic_irq[n], level); +} + +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) +{ + DeviceState *dev; + SysBusDevice *d; + unsigned int i; + + if (kvm_ioapic_in_kernel()) { + dev = qdev_create(NULL, TYPE_KVM_IOAPIC); + } else { + dev = qdev_create(NULL, TYPE_IOAPIC); + } + if (parent_name) { + object_property_add_child(object_resolve_path(parent_name, NULL), + "ioapic", OBJECT(dev), NULL); + } + qdev_init_nofail(dev); + d = SYS_BUS_DEVICE(dev); + sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); + + for (i = 0; i < IOAPIC_NUM_PINS; i++) { + gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); + } +} + struct setup_data { uint64_t next; uint32_t type; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ca641e8..e512838 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -3,11 +3,9 @@ #include "exec/memory.h" #include "hw/boards.h" -#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "hw/block/flash.h" #include "net/net.h" -#include "hw/i386/ioapic.h" #include "hw/i386/x86.h" #include "qemu/range.h" @@ -134,17 +132,6 @@ typedef struct PCMachineClass { /* ioapic.c */ -/* Global System Interrupts */ - -#define GSI_NUM_PINS IOAPIC_NUM_PINS - -typedef struct GSIState { - qemu_irq i8259_irq[ISA_NUM_IRQS]; - qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; -} GSIState; - -void gsi_handler(void *opaque, int n, int level); - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled); /* vmport.c */ @@ -188,7 +175,6 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *rom_memory, MemoryRegion **ram_memory); uint64_t pc_pci_hole64_start(void); -qemu_irq pc_allocate_cpu_irq(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, @@ -206,18 +192,12 @@ void pc_pci_device_init(PCIBus *pci_bus); typedef void (*cpu_set_smm_t)(int smm, void *arg); void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); ISADevice *pc_find_fdc0(void); int cmos_get_fd_drive_type(FloppyDriveType fd0); -#define FW_CFG_IO_BASE 0x510 - #define PORT92_A20_LINE "a20" -/* hpet.c */ -extern int no_hpet; - /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory); diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 97d1575..41fe37b 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -23,6 +23,8 @@ #include "hw/boards.h" #include "hw/nmi.h" +#include "hw/isa/isa.h" +#include "hw/i386/ioapic.h" typedef struct { /*< private >*/ @@ -100,4 +102,20 @@ void x86_load_linux(X86MachineState *x86ms, bool x86_machine_is_smm_enabled(X86MachineState *x86ms); +/* Global System Interrupts */ + +#define GSI_NUM_PINS IOAPIC_NUM_PINS + +typedef struct GSIState { + qemu_irq i8259_irq[ISA_NUM_IRQS]; + qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; +} GSIState; + +qemu_irq x86_allocate_cpu_irq(void); +void gsi_handler(void *opaque, int n, int level); +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); + +/* hpet.c */ +extern int no_hpet; + #endif diff --git a/target/i386/kvm.c b/target/i386/kvm.c index c7ff67a..55e6265 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -35,7 +35,7 @@ #include "qemu/main-loop.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic-msidef.h" diff --git a/target/i386/machine.c b/target/i386/machine.c index 2699eed..b6720d8 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -1,10 +1,10 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "migration/cpu.h" #include "hyperv.h" +#include "hw/i386/x86.h" #include "kvm_i386.h" #include "sysemu/kvm.h" From patchwork Thu Dec 12 17:29:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kFR7NGw/"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhtB5zYhz9sR4 for ; Fri, 13 Dec 2019 05:20:18 +1100 (AEDT) Received: from localhost ([::1]:35524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifT4S-0004Vd-0R for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:20:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58641) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHH-0005OI-1k for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHF-00048W-QK for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:26 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHF-000473-JT for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:25 -0500 Received: by mail-wr1-x432.google.com with SMTP id c14so3620990wrn.7 for ; Thu, 12 Dec 2019 09:29:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=vWWgH5pcpTYoxVZTGFL4hsaj2N4wlcdSO1zlmQtykhQ=; b=kFR7NGw//Vjykkf4Q6mTfyYPasVVQroIQF38d2V77Iacq8dJcXmnipxw6SUxDNDGLd KvAjDStUawP1/CUWwhQ35GuVbSXUlcnzCMvBnGMEz+exSV9MDwe9YvdRuIeylAGSjOH3 FyG3yS2vwsrS/lVMR29JOcHRS3ebcQupfi0aecESOW0cxI9Z4oUEDHRaXC828p4A0UR0 vNX4NZFmShlnkdJIJrtetgeUflIRSNDgziNTxMUyI98dcKwL5J7EDkM+RCfe0RP/Ilic TVwbaOk5NIdNm96868NWdw9Xit3548LG0b6340nl0mMZfjaIkfLIFvS317+5vklznSCl pPlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=vWWgH5pcpTYoxVZTGFL4hsaj2N4wlcdSO1zlmQtykhQ=; b=hlan74uM9NhDzDX8avMaH9Q39v0VgS2JvBkDSQG118PGVs3Pb7a7MnFynaFbB7crY2 szB4c0JhOgmyTdYpu4trqYi/K0xcvtAev8FA7CH5gTzvrJsMaSxqwqEh+6NgDDw1jqsS RdPrNlZKW1m9EKja7i1mop0hl2NGz5DaQED7RBG6Jqk4Ewq/k7gHqpaVJRDdhvilevwK WqNBXHCYWGHz9Rr/vyoKjckEl+f/oJI4sQMWehbZyzQadgASDpJ+eQuG2MpevkZM0edy 7RI67oMcjz5XfT//MtpTPG+d0bombtqf2Ee9AugCQy3qmUgDxmPA044h3EILOnfhev0C Bgxw== X-Gm-Message-State: APjAAAWPZIZE3/S437beiR00imU8jYZNZFPM2W0sDD7BR44bQai3RGIq qntk7PvvS1gDZFEdbESGkQfgSJY9 X-Google-Smtp-Source: APXvYqx7BgmEU1kZG5G4gs29lbLLF6RLFDwo7LimWEVdMTUwudIUVs3P45UzrGV8ulq6YC5p/1xupg== X-Received: by 2002:adf:f98c:: with SMTP id f12mr7290728wrr.138.1576171764320; Thu, 12 Dec 2019 09:29:24 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 7/8] acpi: move PC stubs out of stubs/ Date: Thu, 12 Dec 2019 18:29:13 +0100 Message-Id: <1576171754-45138-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is a small cleanup that lets libqemuutil build without include/hw/i386/pc.h. Signed-off-by: Paolo Bonzini --- hw/acpi/Makefile.objs | 1 + stubs/pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c | 0 stubs/Makefile.objs | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename stubs/pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c (100%) diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 655a9c1..e772e89 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -8,6 +8,7 @@ common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o common-obj-$(CONFIG_ACPI_HW_REDUCED) += generic_event_device.o common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o +common-obj-$(call lnot,$(CONFIG_PC)) += acpi-x86-stub.o common-obj-y += acpi_interface.o common-obj-y += bios-linker-loader.o diff --git a/stubs/pc_madt_cpu_entry.c b/hw/acpi/acpi-x86-stub.c similarity index 100% rename from stubs/pc_madt_cpu_entry.c rename to hw/acpi/acpi-x86-stub.c diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 4a50e95..8b0ff25 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -33,7 +33,6 @@ stub-obj-y += fd-register.o stub-obj-y += qmp_memory_device.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o -stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += vmgenid.o stub-obj-y += xen-common.o stub-obj-y += xen-hvm.o From patchwork Thu Dec 12 17:29:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1208750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="F2yQVm1a"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YhgY6k4Fz9sP6 for ; Fri, 13 Dec 2019 05:10:59 +1100 (AEDT) Received: from localhost ([::1]:35320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSvN-0001VL-Ji for incoming@patchwork.ozlabs.org; Thu, 12 Dec 2019 13:10:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifSHI-0005RC-QM for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifSHH-0004Bl-EW for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:28 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifSHH-00049x-7a for qemu-devel@nongnu.org; Thu, 12 Dec 2019 12:29:27 -0500 Received: by mail-wr1-x441.google.com with SMTP id t2so3661609wrr.1 for ; Thu, 12 Dec 2019 09:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IKjPCPOU0OM2BVq1ly6IsoyhMPu7gfDfI+dPATD0bf4=; b=F2yQVm1asYrGfdb7DiIdz7llbEA7ccrCQ6NsU6Lcf134X96UzkaI4PsKAiXpxkk1nH zOBC27+uJFK5pMB1z/3vmmGNW6BCQNY6jOR7tJxsI05oJhFRnGRlGgxtZbp9D1sFtX0j RPr0a34RGNsFCCdWmszUi8BNdtBEDi9XO0qFaRjx/0mye1PEE9t0QKlNE0jfCSGZrsIg rkhPmRbtW8mYss8QeFowqS3g79Jc1THZw3F3DmK1CyIC8Ng+9WeKKENEdXh1v4BWDz9U nb+stuz0fL70yXtPkq3d7vOuHuMM1P95DDsMSRNTPQ4v7XswkduPBRuf2q8X96Jh8d54 ONOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=IKjPCPOU0OM2BVq1ly6IsoyhMPu7gfDfI+dPATD0bf4=; b=tMu546ywJ9wMn+rmDsWqLh2EXd2f9o6LSKT8+VbggtD1DJ5BIJnF+ARiGpV7px++qm rXbAouDPz0pc/Gwhf99H3aufoKkR9cbJELRWdhusl5cLwSMSJCRu/c1N01frL0TDuRWh GUWMS+xWLc785mvkx8orsHBNbziMdcFpDlUHSbCfv8LHji/8HQUmTOsu8CNmx9ardRjX suCW9wNgI2iE1/u6N5eSSt52WlBXSm3h1UDw4NbWbTFH3ymIJbGPGevqgMT0npCvOO8I t8ZWRFZWKpmh0xfM0SIIpXNOjpdh7+/JnqYtnpu2OrBEI9cPtbKahIrWYyO9zuQUhQCY qxvQ== X-Gm-Message-State: APjAAAXt5RH4gHiokXp6qbsyR/jVWLDu1d4i7ydrTGDDPWdp4d2R8iGL GB0r367Y3TxE5W2MR2IRsrIxLdnb X-Google-Smtp-Source: APXvYqySLXxqjHUfiBg/FVdlrIXTMpxyLGW13v7Z/yEpc5tQePowgJ9ca9L5BXvjCDInpx0lnppifA== X-Received: by 2002:adf:bc87:: with SMTP id g7mr7830514wrh.121.1576171765193; Thu, 12 Dec 2019 09:29:25 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 2sm6810130wrq.31.2019.12.12.09.29.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 09:29:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 8/8] pc: stubify x86 iommu Date: Thu, 12 Dec 2019 18:29:14 +0100 Message-Id: <1576171754-45138-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> References: <1576171754-45138-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, slp@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Allow building microvm without x86-iommu.c and in turn hw/i386/pc.h. Signed-off-by: Paolo Bonzini --- hw/i386/Kconfig | 6 ++++++ hw/i386/Makefile.objs | 3 ++- hw/i386/x86-iommu-stub.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletions(-) create mode 100644 hw/i386/x86-iommu-stub.c diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 5a49434..91cf584 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -103,11 +103,17 @@ config MICROVM select MC146818RTC select VIRTIO_MMIO +config X86_IOMMU + bool + depends on PC + config VTD bool + select X86_IOMMU config AMD_IOMMU bool + select X86_IOMMU config VMPORT bool diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 01ae202..1236c3b 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -6,7 +6,8 @@ obj-$(CONFIG_I440FX) += pc_piix.o obj-$(CONFIG_Q35) += pc_q35.o obj-$(CONFIG_MICROVM) += microvm.o obj-y += fw_cfg.o -obj-y += x86-iommu.o +obj-$(CONFIG_X86_IOMMU) += x86-iommu.o +obj-$(call lnot,$(CONFIG_X86_IOMMU)) += x86-iommu-stub.o obj-$(CONFIG_VTD) += intel_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o obj-$(CONFIG_XEN) += ../xenpv/ xen/ diff --git a/hw/i386/x86-iommu-stub.c b/hw/i386/x86-iommu-stub.c new file mode 100644 index 0000000..03576cd --- /dev/null +++ b/hw/i386/x86-iommu-stub.c @@ -0,0 +1,34 @@ +/* + * Stubs for X86 IOMMU emulation + * + * Copyright (C) 2019 Red Hat, Inc. + * + * Author: Paolo Bonzini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/i386/x86-iommu.h" + +void x86_iommu_iec_register_notifier(X86IOMMUState *iommu, + iec_notify_fn fn, void *data) +{ +} + +X86IOMMUState *x86_iommu_get_default(void) +{ + return NULL; +} +