From patchwork Wed May 25 16:57:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 12861444 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 5C177C433EF for ; Wed, 25 May 2022 16:58:27 +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: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:In-Reply-To:References: List-Owner; bh=B3Uj6yrdmYfUA4ZnTXq0kEcBLAv0GTerwrzGFaHm8l4=; b=MySveDnomfoCYO 8yUg0yMNL7HDEs6BQ+hjmqIsgNbTpr+W0sEjZAh4CCuGsk6iuRXshWWXKWGgHAjzZUm8e2BzvoEUn 2hOpJWyoMl9/p4J4rWHIYRuJSvxdzRBDlurXjtcPCn4uXnsvSMfxCfpoKeG8pE8yLwn7w/GLM2+C3 WtlzuT/DZIBnVFu59SQ45dlFPQdB+5oT2NjGtkUWiNLMkXGN5G01A5YQJv/YVJw/gArPbe59cYhbm mD9nyuJ3iY4pzJMRy1XVKKOAm4qQprZyauPBT3wD7ccHlcwrwsM6ymAHIysYdmcbllqtJcyPO0rVy 9q3xLbx5AMDoumHOVf4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntuJn-00BuFZ-Mw; Wed, 25 May 2022 16:57:07 +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 1ntuJk-00BuED-MI for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 16:57:06 +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 5146E1424; Wed, 25 May 2022 09:57:02 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5ECD43F66F; Wed, 25 May 2022 09:57:01 -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 0/2] Fixes for arm64 and MIPS Date: Wed, 25 May 2022 17:57:02 +0100 Message-Id: <20220525165704.186754-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_095704_812808_EA8D1D0E X-CRM114-Status: GOOD ( 15.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 The first fix is for arm64, where the VCPUs weren't pinned correctly with --vcpu-affinity when creating an aarch32 guest. Hopefully the patch is straightforward. The last patch is a fix for MIPS not compiling for a year now, ever since hw/serial.c was changed to use a different address for arm/arm64 in commit 45b4968e0de1 ("hw/serial: ARM/arm64: Use MMIO at higher addresses"). Did some digging and it turns out that the serial never worked on MIPS since RAM starts at 0 for the architecture. So I just removed hw/serial.o from the list of compilation objects, which revelead that kvm-ipc assumes that all architectures use the 16550/8250 UART. Added a stub for serial8250__inject_sysreg() to MIPS to fix that. Note that as far as I can tell powerpc is in the same situation as MIPS: RAM starts at 0 and ends at 64TB (that's terabytes), so the UART was never working. It looks like powerpc uses hypercalls to emulate a console with the name "hvterm" (devicetree node created in kvm.c and emulation implemented in spapr_hvcons.{c,h}). I don't know enough about the powerpc architecture and I don't have a machine to test it on, and since powerpc still compiles, I opted not to do any changes to the architecture. Tested by cross-compiling both patches for all architectures (arm, arm64, mips, powerpc, riscv, x86), running a kernel on x86, and running kvm-unit-tests for both arm and arm64 on a rockpro64 (has two PMUs). Alexandru Elisei (2): arm64: Honor --vcpu-affinity for aarch32 guests mips: Do not emulate a serial device Makefile | 7 +++++-- arm/aarch64/kvm-cpu.c | 22 ++++++++++++---------- mips/kvm.c | 5 +++++ 3 files changed, 22 insertions(+), 12 deletions(-)