From nobody Fri May 17 03:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1653252358; cv=none; d=zohomail.com; s=zohoarc; b=ho2omiKUrp0y5cev87Fs2dB4Vs0rcHU/MAy1xVEt9N09vAP0ji1VChy8psy41MF3F2Z0ZvslRYLUKxrTzFFr/Lky7l1snF+Gwh33pMEYbE0/f8APPH30btZ56Y/74pzutI/8Sx5QdL1Zq6hfYi+elCK1koV4F4Sst7M/Wg6xnPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653252358; h=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=ylCjogea0jWtmYCFYepyEfou1aCUj4CqclhqM1wzag4=; b=KX369ATFFsotaM0KM+IckNarLkFAS490Kw9UsvpBc3gNx5ln2N1RPwFfNVgnsAJOfW0yDslt3aqbIeTUkSnhfKSZOs06fsRj2+967a/Wj09qekSRoHyQ9RZW8yDH8yTe1XRfNacYwxOzVe/Fcq2DEOgKyfuARMzGHgL1X4xOveQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653252358976683.3824480669643; Sun, 22 May 2022 13:45:58 -0700 (PDT) Received: from localhost ([::1]:49306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nssSb-0006yN-2c for importer@patchew.org; Sun, 22 May 2022 16:45:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nssQy-0004b1-W6; Sun, 22 May 2022 16:44:17 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:44726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nssQx-0008Px-DY; Sun, 22 May 2022 16:44:16 -0400 Received: by mail-ej1-x635.google.com with SMTP id f21so11261517ejh.11; Sun, 22 May 2022 13:44:14 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-054-075-232.78.54.pool.telefonica.de. [78.54.75.232]) by smtp.gmail.com with ESMTPSA id f8-20020a1709063f4800b006f4c82c2b12sm5533968ejj.19.2022.05.22.13.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 13:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ylCjogea0jWtmYCFYepyEfou1aCUj4CqclhqM1wzag4=; b=j2g63YMuiS8gamKqquXjWGnOM8lYoMD50H7b6wR6enqmly5dtJajQSGoMbkaf9XA5N kkSDDr+ObiDk2EYpytn1sEd5GS/DhKOFyZb1JVd1wKtR64nz6LjJrH8/7FJPPQ4v27yT 8gOnRUlFn2F13tOUbGRj4F7ZkQNv7GAJjuIM/ii+5DbzevLcyqa8KtiKJa2NOdhW848z /9B4kypJEKXyfoQZzs0N36R5xvBgFFfVMXqdEvqfUqYerkR2edGPVyNVWO2L8AV9spAv K+3PzHZq42Fuda8AZJSRdAAOvW9zINO9YGJ1RWjq2QFc3JQyU5+CnHrOw2mFlT3+/3LM prhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ylCjogea0jWtmYCFYepyEfou1aCUj4CqclhqM1wzag4=; b=StpQTk0XNCktlXIpcF5cQyDsCVEym1Lz1Qw0/v1v7cmR0rfHzfaLMNnimt3sfcsVwo iZgRKhuKMlpW/yEiaE5VzsLiK3nrUD+bU+SaCjBbRtDncTvKAnwaNVEjXswxOmlTVo6P 58HIS4eFyiYItXp+xRTr5/zczBbSOEt63N7bDoyHtJDPiZeMA0TGawpqB5ZjwEHBal21 3VxvDRHWJ9fYE4eU3eYizMAdDqmE4k53Mw9pa2mwwjlZ8DYNS9cqHubvMrke+tT47NyU QiZfETbWcDYz05+ttHnISfNcy5pYksrRgoY2uQT3RR9HQIPxCtEDdl+2bSuttcmxHng8 QWPA== X-Gm-Message-State: AOAM532aarUWyVjIJWCrtialbRvLXsBL9nU+8e2VM9dweCkI5n/nXX4l RKBNOwTJS1ee0ezt3aPRfKF2a8SMLjA= X-Google-Smtp-Source: ABdhPJzYxfOK8xQfYCqcgX3nFpSbUlIPlv0zbQzLp3rsNhmmC9pmrcGY1eGAyyYeAzae3DycEKulEQ== X-Received: by 2002:a17:907:971b:b0:6fe:c0f8:457a with SMTP id jg27-20020a170907971b00b006fec0f8457amr6091801ejc.760.1653252253573; Sun, 22 May 2022 13:44:13 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v2 1/3] hw/i386/microvm-dt: Force explicit failure if retrieving QOM property fails Date: Sun, 22 May 2022 22:43:45 +0200 Message-Id: <20220522204347.10438-2-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220522204347.10438-1-shentey@gmail.com> References: <20220522204347.10438-1-shentey@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::635; envelope-from=shentey@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1653252361116100003 Content-Type: text/plain; charset="utf-8" New code will be added where this is best practice. So update existing code as well. Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/microvm-dt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 9c3c4995b4..fde74819f2 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -32,6 +32,7 @@ */ #include "qemu/osdep.h" #include "qemu/cutils.h" +#include "qapi/error.h" #include "sysemu/device_tree.h" #include "hw/char/serial.h" #include "hw/i386/fw_cfg.h" @@ -187,8 +188,8 @@ static void dt_add_ioapic(MicrovmMachineState *mms, Sys= BusDevice *dev) static void dt_add_isa_serial(MicrovmMachineState *mms, ISADevice *dev) { const char compat[] =3D "ns16550"; - uint32_t irq =3D object_property_get_int(OBJECT(dev), "irq", NULL); - hwaddr base =3D object_property_get_int(OBJECT(dev), "iobase", NULL); + uint32_t irq =3D object_property_get_int(OBJECT(dev), "irq", &error_fa= tal); + hwaddr base =3D object_property_get_int(OBJECT(dev), "iobase", &error_= fatal); hwaddr size =3D 8; char *nodename; =20 --=20 2.36.1 From nobody Fri May 17 03:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1653252475; cv=none; d=zohomail.com; s=zohoarc; b=UjIHbDJ6Cv16M4Un5mjofzlUFvtL4PqI2dnRO9nrnMLgjnHqCzlX/YZ+6LIG9v1V1QLUSeWILmGpBfP8GW57zSpzole3un5snkoufXkklRAYbxrOmTxiizMDuTlQCvIV8OsMzLT0cQnAOrQVXDYOMUKjN4LgkJfM3/ycNqGAgkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653252475; h=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=WoiVLmOvFiBXBWe7BQz1kBS+GqA1IFsINI5KHtpnXF0=; b=M9Egc+gi75kIVXZesiqAiV5GgIalx3qSa3QSBLoKL6qcnTFdBK/EWLB8P0ht1nn7+LrffBTuFo12ekmVspx3zo5SOBLnAAyCIRBs1uVa7843dwPMh2Oi+2jx1fVd4giUvjuZuFu+3E4RpomJIwe7dXwtBQIrBJctTC2jHpK+P4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653252475417732.8327506130735; Sun, 22 May 2022 13:47:55 -0700 (PDT) Received: from localhost ([::1]:54758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nssUU-0002aW-5z for importer@patchew.org; Sun, 22 May 2022 16:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nssR0-0004dg-EF; Sun, 22 May 2022 16:44:18 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:40719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nssQy-0008QC-Ua; Sun, 22 May 2022 16:44:18 -0400 Received: by mail-ej1-x632.google.com with SMTP id wh22so24784376ejb.7; Sun, 22 May 2022 13:44:16 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-054-075-232.78.54.pool.telefonica.de. [78.54.75.232]) by smtp.gmail.com with ESMTPSA id f8-20020a1709063f4800b006f4c82c2b12sm5533968ejj.19.2022.05.22.13.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 13:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WoiVLmOvFiBXBWe7BQz1kBS+GqA1IFsINI5KHtpnXF0=; b=B5WHxfXpTNYcmSUTWIRfwU+BE2kYxbPuynIhKtm7Ci1Mr79nNBJhej69Z2fO36U7c2 v+fuxqA1Cw9rfg6cWzwfcGBAcxg7SWzeHyrcHxshgZl+bX+ZQeTpDslAYgb0HErEhr9P MMZcUjfZPZvPrNByPcGr/7cTV9A0jItJbwIkDRhY+oBCZs/22qUK2h7sYc7MsDF0WrCN x1YzWVezIm5OwpXnGQlLHYwDskwjVYd8iYrwqPSz+d+F5rbbxewJPe6JLtmGT0Xc8yVF mLpb+PrT3F5LzM5BFr4ZrUDG25PAHKlRZhnTSlHg31a2CYZeMbAB3bgN/T8Mzlo8NODw Kgcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WoiVLmOvFiBXBWe7BQz1kBS+GqA1IFsINI5KHtpnXF0=; b=CtlyDVnFKoHx15bKZ73Vm2Ht466AYTroNZSJbVX62Y+ui1hGrwNkHsfYvMtHf4f9x7 AKapYGh0EzNnWfkOiCUCjeoJUU3u7wz2FfzFsP6IOdPX/VPFA85uwVgwWwHVV90aLUoL reC/u1mCQHrh808MFPxIZ/+rFV5u12bEGRVFU1LwKvV5noegRSa62uBQMABbovH7AlW3 gYFxGB5LxzY3Ivom8MQNtUGJAmFMeo5hphvnd2OVj1Itjod4qUuqot4X+kvPYLc86XHf 0w0RW3qVc90syVK3TVNriXYa08hF5g0uyzZnxkyKgkpfJShUhVx12rNHDsxndDgwt/4q u+2w== X-Gm-Message-State: AOAM532FB43ZDrnMLT0HX8Pro2uPqeyokMlXAG0p1cd+TF8yRii/vXlS +aTrAQgpdQo9kyMptUy1yV1rGjm+TDo= X-Google-Smtp-Source: ABdhPJz3GjvnMMOjMSFm+lZ9mpBo+Et7tlUdoSU/U/uqf71o/2nVNfN4WZVTN5NyKg8R+SrzE4i/3Q== X-Received: by 2002:a17:907:8693:b0:6f8:635a:1d32 with SMTP id qa19-20020a170907869300b006f8635a1d32mr16874067ejc.663.1653252255246; Sun, 22 May 2022 13:44:15 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Bernhard Beschow , Mark Cave-Ayland , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH v2 2/3] hw/i386/microvm-dt: Determine mc146818rtc's IRQ number from QOM property Date: Sun, 22 May 2022 22:43:46 +0200 Message-Id: <20220522204347.10438-3-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220522204347.10438-1-shentey@gmail.com> References: <20220522204347.10438-1-shentey@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::632; envelope-from=shentey@gmail.com; helo=mail-ej1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1653252477408100001 Content-Type: text/plain; charset="utf-8" Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/ mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is configurable. Fix microvm-dt to respect its value. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/microvm-dt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index fde74819f2..287818c641 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -209,7 +209,7 @@ static void dt_add_isa_serial(MicrovmMachineState *mms,= ISADevice *dev) static void dt_add_isa_rtc(MicrovmMachineState *mms, ISADevice *dev) { const char compat[] =3D "motorola,mc146818"; - uint32_t irq =3D RTC_ISA_IRQ; + uint32_t irq =3D object_property_get_uint(OBJECT(dev), "irq", &error_f= atal); hwaddr base =3D RTC_ISA_BASE; hwaddr size =3D 8; char *nodename; --=20 2.36.1 From nobody Fri May 17 03:00:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1653252368; cv=none; d=zohomail.com; s=zohoarc; b=oAlySgkofLffrkKI5006sVxKPZAY7jlKS3IGTsRSH2w9vOzGtAXN/GJcseFFYPFXameJDNZJn8CA1++RHaugn/gaAsTkx1BymqQhcr6lTwZO1wPZgdfoNIJmmqbIEFiCZ2PUWGCWWhcx5p2RqttA7zbYj3qL5kqzfswyTiohB3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653252368; h=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=HLmyp2v6u2KnfE60H0vn5WW8/V+q8TYyhHAblXSEP7o=; b=A/h6Vv9OdOhcjUWEwzI+6THja6gi5y14lAlVehHRM1V5U0rV5a1w5YkWYKul2uiQRsImmqPgY5pIiLawGUkuyut5a+XDMkCNmBGWkOJgt2Cw0ImnbN7tbREWlbS/3iup5rcIiaH9tN0eCgurMMgSvVKPzIxk0mSCLNZUPfnYoMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653252368494267.817573201758; Sun, 22 May 2022 13:46:08 -0700 (PDT) Received: from localhost ([::1]:49890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nssSk-0007Sm-G1 for importer@patchew.org; Sun, 22 May 2022 16:46:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nssR3-0004lX-0V; Sun, 22 May 2022 16:44:21 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:39775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nssR1-0008QS-C2; Sun, 22 May 2022 16:44:20 -0400 Received: by mail-ej1-x630.google.com with SMTP id gh17so11881525ejc.6; Sun, 22 May 2022 13:44:18 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-054-075-232.78.54.pool.telefonica.de. [78.54.75.232]) by smtp.gmail.com with ESMTPSA id f8-20020a1709063f4800b006f4c82c2b12sm5533968ejj.19.2022.05.22.13.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 13:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HLmyp2v6u2KnfE60H0vn5WW8/V+q8TYyhHAblXSEP7o=; b=N7hRgUaCgoi6bpss3zaeIwlWMdAbSfeKEzM16DAAOq/idUOgntWDrIsgCAVNZt3FKZ onaKPTwF/OHzCM1lBSk1mMDfHg4852UXZU9g/t48JlzqD4s3zV3wKYSwJw2jlG7R6oSE lVHRBbEnsyWT9I46OD9jquWrhEdwhyMtBteSdy7MrZZfLXcpNqlBvBdVuDXpm/0QnuQ2 u3aREr18KlJTapMrx11vAuhk1+s36wXphw5ugXmpM4JIF9Ed/1Pw6d7Eztd74uPwJr4u LyWfYNR3wYJhEw7HjNfhEnY5KDNmU0/v8fNJiZTix10aC6QPQh49up2GBW/kVYYUgGDR 4nlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HLmyp2v6u2KnfE60H0vn5WW8/V+q8TYyhHAblXSEP7o=; b=x3dWWImcKw8M7g+xf+/dqp1pIQCA3/hU0gz4c/dEPduLkGDHDJHP6OliOc7PykSgfB 4vaUUSVwT11W8a07jmaZ2+XewUugD0u8eSQ+kuSGclqGDT4tZQhBT7O0GEeyQNUKUVB1 cAnS13hgWhZdZM30SrSq3EwE5+9OosHxuFJvbWpBz1G6WIuiBG16U5lKVx7G/HEYZ2eq i1/8OzeKbrO8oZNWhqrpSaXwSuhVhh8wql1J418sTqkoB9iX/CoWhCGIZGQ3yiAQCnUG RivOy+H7s5dy+Bbv9rh+NHS0/jgEtc72T6oVDp8FYT4q2Xuhzyupsqbp4SrgqFf0yWZU pQ8w== X-Gm-Message-State: AOAM533rTbv2FnH/YPahSrrT4mqJOFhQyAIc5iU4U0f5U6RoVShcLCkJ D6bgCcvHgME3ychOmB7WniScxxjq8yA= X-Google-Smtp-Source: ABdhPJyZ+h2Ed9VfeM3UpbsGGrW5uKV4WYvSk4BOR/lGRvr1RD7K3p5/88aiPlGWKzFTcy75zaXA8Q== X-Received: by 2002:a17:907:6d15:b0:6fd:d985:889b with SMTP id sa21-20020a1709076d1500b006fdd985889bmr17386832ejc.753.1653252257075; Sun, 22 May 2022 13:44:17 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Bernhard Beschow , Mark Cave-Ayland , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH v2 3/3] rtc/mc146818rtc: QOM'ify io_base offset Date: Sun, 22 May 2022 22:43:47 +0200 Message-Id: <20220522204347.10438-4-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220522204347.10438-1-shentey@gmail.com> References: <20220522204347.10438-1-shentey@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::630; envelope-from=shentey@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1653252369264100001 Content-Type: text/plain; charset="utf-8" Exposing the io_base offset as a QOM property not only allows it to be configurable but also to be displayed in HMP: Before: (qemu) info qtree ... dev: mc146818rtc, id "" gpio-out "" 1 base_year =3D 0 (0x0) irq =3D 8 (0x8) lost_tick_policy =3D "discard" After: dev: mc146818rtc, id "" gpio-out "" 1 base_year =3D 0 (0x0) iobase =3D 112 (0x70) irq =3D 8 (0x8) lost_tick_policy =3D "discard" Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/microvm-dt.c | 2 +- hw/rtc/mc146818rtc.c | 9 ++++++--- include/hw/rtc/mc146818rtc.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 287818c641..b3049e4f9f 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -210,7 +210,7 @@ static void dt_add_isa_rtc(MicrovmMachineState *mms, IS= ADevice *dev) { const char compat[] =3D "motorola,mc146818"; uint32_t irq =3D object_property_get_uint(OBJECT(dev), "irq", &error_f= atal); - hwaddr base =3D RTC_ISA_BASE; + hwaddr base =3D object_property_get_uint(OBJECT(dev), "iobase", &error= _fatal); hwaddr size =3D 8; char *nodename; =20 diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index f235c2ddbe..5a5dd21a3c 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -74,6 +74,8 @@ #define RTC_CLOCK_RATE 32768 #define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768) =20 +#define RTC_ISA_BASE 0x70 + static void rtc_set_time(RTCState *s); static void rtc_update_time(RTCState *s); static void rtc_set_cmos(RTCState *s, const struct tm *tm); @@ -941,7 +943,7 @@ static void rtc_realizefn(DeviceState *dev, Error **err= p) qemu_register_suspend_notifier(&s->suspend_notifier); =20 memory_region_init_io(&s->io, OBJECT(s), &cmos_ops, s, "rtc", 2); - isa_register_ioport(isadev, &s->io, RTC_ISA_BASE); + isa_register_ioport(isadev, &s->io, s->io_base); =20 /* register rtc 0x70 port for coalesced_pio */ memory_region_set_flush_coalesced(&s->io); @@ -950,7 +952,7 @@ static void rtc_realizefn(DeviceState *dev, Error **err= p) memory_region_add_subregion(&s->io, 0, &s->coalesced_io); memory_region_add_coalescing(&s->coalesced_io, 0, 1); =20 - qdev_set_legacy_instance_id(dev, RTC_ISA_BASE, 3); + qdev_set_legacy_instance_id(dev, s->io_base, 3); =20 object_property_add_tm(OBJECT(s), "date", rtc_get_date); =20 @@ -983,6 +985,7 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year= , qemu_irq intercept_irq) =20 static Property mc146818rtc_properties[] =3D { DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980), + DEFINE_PROP_UINT32("iobase", RTCState, io_base, RTC_ISA_BASE), DEFINE_PROP_UINT8("irq", RTCState, isairq, RTC_ISA_IRQ), DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState, lost_tick_policy, LOST_TICK_POLICY_DISCARD), @@ -1028,7 +1031,7 @@ static void rtc_build_aml(ISADevice *isadev, Aml *sco= pe) * does, even though qemu only responds to the first two ports. */ crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE, RTC_ISA_BASE, + aml_append(crs, aml_io(AML_DECODE16, s->io_base, s->io_base, 0x01, 0x08)); aml_append(crs, aml_irq_no_flags(s->isairq)); =20 diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h index 33d85753c0..1f7942a9f8 100644 --- a/include/hw/rtc/mc146818rtc.h +++ b/include/hw/rtc/mc146818rtc.h @@ -26,6 +26,7 @@ struct RTCState { uint8_t cmos_data[128]; uint8_t cmos_index; uint8_t isairq; + uint32_t io_base; int32_t base_year; uint64_t base_rtc; uint64_t last_update; @@ -49,7 +50,6 @@ struct RTCState { }; =20 #define RTC_ISA_IRQ 8 -#define RTC_ISA_BASE 0x70 =20 ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq); --=20 2.36.1