From patchwork Wed May 25 16:57:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 12861446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 132F0C433F5 for ; Wed, 25 May 2022 16:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=za+G3FngGHOym4rzKszUe1v97uxX4awM+PZgVBBQxHU=; b=2WS4qrd8fYHo6n KTxj73U1J4fvzYLrkg5JQnm8bDe1jeRcmlsBFIBIPd4Q9f+qV8w45xHHlp92vjEo6hWM3Ar3CqSSv 5npXKSfT6Ix02Xh2En0QZm7RqMtMwOxPjdvqcwhZn2t7t1ZhE35u+o3w7FSzNurz75s4Od8N1b1au N/sL3cXEtPEQGP+6zZsxO3jzhRu/dxWiDA/3ejxQzOoJp9QObxIcnXaXmjmdCUBj2k/A9FJQGqgWO baLvb4brcO+M2H2+EKU60E0nqRLb08Q7gqFGgVCZtRffIUWYLwz90tKXzAm1Txe80GTnnRqanik5C uZ9BlM9AgitGx152dO7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntuK4-00BuHj-3T; Wed, 25 May 2022 16:57:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntuJm-00BuFC-NT for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 16:57:08 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 910631474; Wed, 25 May 2022 09:57:05 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D6293F66F; Wed, 25 May 2022 09:57:04 -0700 (PDT) From: Alexandru Elisei To: will@kernel.org, julien.thierry.kdev@gmail.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com Subject: [PATCH kvmtool 2/2] mips: Do not emulate a serial device Date: Wed, 25 May 2022 17:57:04 +0100 Message-Id: <20220525165704.186754-3-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525165704.186754-1-alexandru.elisei@arm.com> References: <20220525165704.186754-1-alexandru.elisei@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_095706_895117_C4694FC3 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 45b4968e0de1 ("hw/serial: ARM/arm64: Use MMIO at higher addresses") changed how the address for the UART is computed by using KVM_IOPORT_AREA. The symbol is not defined for MIPS, which results in the following compilation error: hw/serial.c:21:27: error: ‘KVM_IOPORT_AREA’ undeclared here (not in a function); did you mean ‘KVM_MIPS_IOPORT_AREA’? 21 | #define serial_iobase_0 (KVM_IOPORT_AREA + 0x3f8) | ^~~~~~~~~~~~~~~ hw/serial.c:29:27: note: in expansion of macro ‘serial_iobase_0’ 29 | #define serial_iobase(nr) serial_iobase_##nr | ^~~~~~~~~~~~~~ hw/serial.c:92:15: note: in expansion of macro ‘serial_iobase’ 92 | .iobase = serial_iobase(0), | ^~~~~~~~~~~~~ Before the commit, the serial was placed at addresses 0x3f8, 0x2f8, 0x3e8 and 0x2e8. However, MIPS puts the RAM at those addresses, up to KVM_MMIO_START, which is 0x10000000. Meaning that serial device emulation never worked, as those addresses were part of a valid memslot representing memory. This has been the case since commit 7281a8db199b ("kvm tools, mips: Add MIPS support") from 2014. A quick examination of the MIPS code reveals that the architecture relies on hypercalls from the guest and the virtio console for input and output. Since nobody complained about the missing serial device, assume that it is indeed not needed and do not compile it for MIPS. Signed-off-by: Alexandru Elisei --- Makefile | 7 +++++-- mips/kvm.c | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9e67c7637b1e..6464446a9f24 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,6 @@ OBJS += disk/core.o OBJS += framebuffer.o OBJS += guest_compat.o OBJS += hw/rtc.o -OBJS += hw/serial.o OBJS += irq.o OBJS += kvm-cpu.o OBJS += kvm.o @@ -127,6 +126,7 @@ endif ifeq ($(ARCH),x86) DEFINES += -DCONFIG_X86 OBJS += hw/i8042.o + OBJS += hw/serial.o OBJS += x86/boot.o OBJS += x86/cpuid.o OBJS += x86/interrupt.o @@ -144,6 +144,7 @@ endif # POWER/ppc: Actually only support ppc64 currently. ifeq ($(ARCH), powerpc) DEFINES += -DCONFIG_PPC + OBJS += hw/serial.o OBJS += powerpc/boot.o OBJS += powerpc/ioport.o OBJS += powerpc/kvm.o @@ -161,7 +162,8 @@ endif # ARM OBJS_ARM_COMMON := arm/fdt.o arm/gic.o arm/gicv2m.o arm/ioport.o \ - arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o + arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o \ + hw/serial.o HDRS_ARM_COMMON := arm/include ifeq ($(ARCH), arm) DEFINES += -DCONFIG_ARM @@ -203,6 +205,7 @@ endif ifeq ($(ARCH),riscv) DEFINES += -DCONFIG_RISCV ARCH_INCLUDE := riscv/include + OBJS += hw/serial.o OBJS += riscv/fdt.o OBJS += riscv/ioport.o OBJS += riscv/irq.o diff --git a/mips/kvm.c b/mips/kvm.c index 3470dbb2e433..e668cbbefb25 100644 --- a/mips/kvm.c +++ b/mips/kvm.c @@ -1,3 +1,4 @@ +#include "kvm/8250-serial.h" #include "kvm/kvm.h" #include "kvm/ioport.h" #include "kvm/virtio-console.h" @@ -359,3 +360,7 @@ bool kvm__arch_load_kernel_image(struct kvm *kvm, int fd_kernel, int fd_initrd, void ioport__map_irq(u8 *irq) { } + +void serial8250__inject_sysrq(struct kvm *kvm, char sysrq) +{ +}