From nobody Mon Feb 9 06:26:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600351103; cv=none; d=zohomail.com; s=zohoarc; b=n3V5RjlKawujnGTd4Ee7Bvj0EU1lnEV1eqUiE1KmFi3pF5+lBqf9Brg7aBbSC/uFwrHSE/+wyCHJrepmnY5K2JEbXqgkJAjkUDCPfEm5bKHItyR5xJ9wx013EgQYHllcT7C2R+wjgvp1s4/KxoudJ4BA+aDBsgqL9Ke8s8CY124= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600351103; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TuItMlpz3oyY7fQG4iAnhQ4/Ntvos+fF0mHSveJa+/8=; b=lOEectnXEclNsg5a1nSXmTKp0COZf9fJVcegyf7jfbkOggAEVfObwTSfEZmsfNyrHR0G39/JaPz6hitMRzzjuhQYt6zoFHReq97vGKvT6SovpC5fRddzg8Yw7ALQacnRCdhRUZOcf5IXmJ6GOzUkvbDNe9R0Qv8exxAh8DdNBN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16003511031146.799104265412211; Thu, 17 Sep 2020 06:58:23 -0700 (PDT) Received: from localhost ([::1]:42928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIuQX-0005Un-Vt for importer@patchew.org; Thu, 17 Sep 2020 09:58:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIuM7-0008Ob-9b for qemu-devel@nongnu.org; Thu, 17 Sep 2020 09:53:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kIuM1-00083A-CX for qemu-devel@nongnu.org; Thu, 17 Sep 2020 09:53:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-VzL6VocAOQu_KwBBNLCW8A-1; Thu, 17 Sep 2020 09:53:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB7AA100747E; Thu, 17 Sep 2020 13:53:36 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EB475576A; Thu, 17 Sep 2020 13:53:35 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA1F11FCEE; Thu, 17 Sep 2020 15:53:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600350820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TuItMlpz3oyY7fQG4iAnhQ4/Ntvos+fF0mHSveJa+/8=; b=VXiMmY379d7v+s1Os1GIlc+RVcihS+3AuV41t+eIoz0o38zkRQxE+XS1ALNaVrWRrL83/B vgSjD+GcQ3YA2wH7cpx8zghCDAcvitiqpegmVqF4nQzUUEsi4zyFXvWuDrGxNNMbxHr1y5 C5af9A2fuhgKolvjwgQkWlSK1YMfRWA= X-MC-Unique: VzL6VocAOQu_KwBBNLCW8A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 07/21] microvm: make virtio irq base runtime configurable Date: Thu, 17 Sep 2020 15:53:09 +0200 Message-Id: <20200917135323.18022-8-kraxel@redhat.com> In-Reply-To: <20200917135323.18022-1-kraxel@redhat.com> References: <20200917135323.18022-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/17 02:01:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eduardo Habkost , Sergio Lopez , "Michael S. Tsirkin" , Shannon Zhao , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Sergio Lopez Reviewed-by: Igor Mammedov Message-id: 20200915120909.20838-8-kraxel@redhat.com --- include/hw/i386/microvm.h | 2 +- hw/i386/microvm.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index 36dbcdd12351..87593694eb0e 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -28,7 +28,6 @@ =20 /* Platform virtio definitions */ #define VIRTIO_MMIO_BASE 0xfeb00000 -#define VIRTIO_IRQ_BASE 5 #define VIRTIO_NUM_TRANSPORTS 8 #define VIRTIO_CMDLINE_MAXLEN 64 =20 @@ -59,6 +58,7 @@ struct MicrovmMachineState { bool auto_kernel_cmdline; =20 /* Machine state */ + uint32_t virtio_irq_base; bool kernel_cmdline_fixed; }; typedef struct MicrovmMachineState MicrovmMachineState; diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index b1dc7e49c159..e4501f2cdfbd 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -121,10 +121,11 @@ static void microvm_devices_init(MicrovmMachineState = *mms) =20 kvmclock_create(); =20 + mms->virtio_irq_base =3D 5; for (i =3D 0; i < VIRTIO_NUM_TRANSPORTS; i++) { sysbus_create_simple("virtio-mmio", VIRTIO_MMIO_BASE + i * 512, - x86ms->gsi[VIRTIO_IRQ_BASE + i]); + x86ms->gsi[mms->virtio_irq_base + i]); } =20 /* Optional and legacy devices */ @@ -227,7 +228,7 @@ static void microvm_memory_init(MicrovmMachineState *mm= s) x86ms->ioapic_as =3D &address_space_memory; } =20 -static gchar *microvm_get_mmio_cmdline(gchar *name) +static gchar *microvm_get_mmio_cmdline(gchar *name, uint32_t virtio_irq_ba= se) { gchar *cmdline; gchar *separator; @@ -247,7 +248,7 @@ static gchar *microvm_get_mmio_cmdline(gchar *name) ret =3D g_snprintf(cmdline, VIRTIO_CMDLINE_MAXLEN, " virtio_mmio.device=3D512@0x%lx:%ld", VIRTIO_MMIO_BASE + index * 512, - VIRTIO_IRQ_BASE + index); + virtio_irq_base + index); if (ret < 0 || ret >=3D VIRTIO_CMDLINE_MAXLEN) { g_free(cmdline); return NULL; @@ -259,6 +260,7 @@ static gchar *microvm_get_mmio_cmdline(gchar *name) static void microvm_fix_kernel_cmdline(MachineState *machine) { X86MachineState *x86ms =3D X86_MACHINE(machine); + MicrovmMachineState *mms =3D MICROVM_MACHINE(machine); BusState *bus; BusChild *kid; char *cmdline; @@ -282,7 +284,8 @@ static void microvm_fix_kernel_cmdline(MachineState *ma= chine) BusState *mmio_bus =3D &mmio_virtio_bus->parent_obj; =20 if (!QTAILQ_EMPTY(&mmio_bus->children)) { - gchar *mmio_cmdline =3D microvm_get_mmio_cmdline(mmio_bus-= >name); + gchar *mmio_cmdline =3D microvm_get_mmio_cmdline + (mmio_bus->name, mms->virtio_irq_base); if (mmio_cmdline) { char *newcmd =3D g_strjoin(NULL, cmdline, mmio_cmdline= , NULL); g_free(mmio_cmdline); --=20 2.27.0