From nobody Thu May 9 23:52:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602445768; cv=none; d=zohomail.com; s=zohoarc; b=bUlwk+oz5WKYBUhYVmYMqi4QT34TWsdI8OM/rlC0yT1NRstYN+6aI8HrMkpE0P/GI8UfR9xHPzuKVkXMOKrvHy/CoQeKko2LiUlRmVV3B5nuEGDrFhtolZKage/fRse6S1BIrV10MeMEUZ59N2FvWd2qWRVfLU2v7EkWxQxQCHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602445768; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/fQo3DSJb6riAH6KnfckECiEhkMalNL1pPpYvWlbzCc=; b=CjK91awp2w1PAjtVzYUlnN+Ozrsmee+hRIYBNRiKNFu32SSpuwfEK3UC98ZWkHDv7PhTfWXx6tiDaDp9KOe7fW7VR2hmj0XwMMVDlD386uJJW5pmTRyPyOkKEGj5IIOKq52vJeYD5NEv7yoMZjxaBakVtGugRWprqyUz5M7n234= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 1602445768483211.2588899373444; Sun, 11 Oct 2020 12:49:28 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id q5so15362709wmq.0 for ; Sun, 11 Oct 2020 12:49:26 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id n9sm22111984wrq.72.2020.10.11.12.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 12:49:24 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=/fQo3DSJb6riAH6KnfckECiEhkMalNL1pPpYvWlbzCc=; b=fchLa3yE6WsO/FZ+TB5rqAIHERo2Wc0kfScuX4Nd1FAJjMJybOer7ydG7VO4fPRhUM byTxfmCYAFwlw73VF3USnknTVXPX77Ml+HloAqCxwp4ZRiFf1eaa6cQVpUE7nHAVewzR 2CICmGkLiY4fFTNAJcbjESHcyfORodUgr0ysfOzyI+XkeKB71lBmGoa6UsH0ozKWU7+Z ba639AW3CwlVdXtlEaaWUuFPcu/31i7bjxPW7ZIPXVpEB0PNcJUXdx9+aJ78uDX3L32M jnTT8a+bBoE2urRl3hVdSj1VuXC0SuWxuyEmpYtRxmRfu8SnnHw4VEPkbpFhWJyU409A 3Z2A== 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:mime-version:content-transfer-encoding; bh=/fQo3DSJb6riAH6KnfckECiEhkMalNL1pPpYvWlbzCc=; b=W4RhwBcUL8jD3s6VPfaFxtrFOfPxFRNLz+O1DO1MUYqmNls2vPxr9OGPcIuDXArfSg I4XzdJQetK3OdnauAFz7z4Il0B5R7O0E2mfdxSvERablcuPR/DeKXtc7UF9IZZCwrUwq PVOC25DFTPFaZ1cRKJlC+WnsGoUD++jABSjgcc3kYsrwfG8j8fe4psaDKFaUtCRs3Rs/ mRTrRQw0PEA8xCU8SJWHWf9SoDl4zzTUdCSaBArXtMBIn79YaLuDjPbKHxDo0ryhXo/V 2N+Y1WNjcIkqboqKmkzlguuiK9b7pXNvdMf6g9nr0jT2nTDyX6SgQo7+5dZpruYO/RW8 uvcw== X-Gm-Message-State: AOAM533a0Mkv8Kld/xRsd4TEKp8n/ShMXVtFXU7zssvXgGLUmFi66yuO lPS/zg0nEpgLVniRtoxKyGg= X-Google-Smtp-Source: ABdhPJz6A99BRgIPa/1KR4ERdM5WL50IzAC2V7BytlJ8nFXrdYBkI/cd6vxwEbPTmcgpngPy+W2cgw== X-Received: by 2002:a1c:9949:: with SMTP id b70mr7946954wme.116.1602445765529; Sun, 11 Oct 2020 12:49:25 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Aleksandar Rikalo , Peter Maydell , Aurelien Jarno , Jiaxun Yang , Paolo Bonzini , Thomas Huth , Marcel Apfelbaum , Aleksandar Markovic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Laurent Vivier , qemu-trivial@nongnu.org Subject: [PATCH 1/4] hw: Replace magic value by PCI_NUM_PINS definition Date: Sun, 11 Oct 2020 21:49:15 +0200 Message-Id: <20201011194918.3219195-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201011194918.3219195-1-f4bug@amsat.org> References: <20201011194918.3219195-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Use self-explicit PCI_NUM_PINS definition instead of magic value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 4 ++-- hw/mips/gt64xxx_pci.c | 2 +- hw/pci-host/versatile.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e465a988d68..ddad9621f79 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1117,11 +1117,11 @@ static void create_pcie_irq_map(const VirtMachineSt= ate *vms, int first_irq, const char *nodename) { int devfn, pin; - uint32_t full_irq_map[4 * 4 * 10] =3D { 0 }; + uint32_t full_irq_map[4 * PCI_NUM_PINS * 10] =3D { 0 }; uint32_t *irq_map =3D full_irq_map; =20 for (devfn =3D 0; devfn <=3D 0x18; devfn +=3D 0x8) { - for (pin =3D 0; pin < 4; pin++) { + for (pin =3D 0; pin < PCI_NUM_PINS; pin++) { int irq_type =3D GIC_FDT_IRQ_TYPE_SPI; int irq_nr =3D first_irq + ((pin + PCI_SLOT(devfn)) % PCI_NUM_= PINS); int irq_level =3D GIC_FDT_IRQ_FLAGS_LEVEL_HI; diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index e091bc4ed55..ff1a35755f6 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -1018,7 +1018,7 @@ static void gt64120_pci_set_irq(void *opaque, int irq= _num, int level) if (pic_irq < 16) { /* The pic level is the logical OR of all the PCI irqs mapped to i= t. */ pic_level =3D 0; - for (i =3D 0; i < 4; i++) { + for (i =3D 0; i < PCI_NUM_PINS; i++) { if (pic_irq =3D=3D piix4_dev->config[PIIX_PIRQCA + i]) { pic_level |=3D pci_irq_levels[i]; } diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index 3553277f941..b4951023f4e 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -75,7 +75,7 @@ enum { struct PCIVPBState { PCIHostState parent_obj; =20 - qemu_irq irq[4]; + qemu_irq irq[PCI_NUM_PINS]; MemoryRegion controlregs; MemoryRegion mem_config; MemoryRegion mem_config2; @@ -412,7 +412,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **e= rrp) =20 object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_= HOST); =20 - for (i =3D 0; i < 4; i++) { + for (i =3D 0; i < PCI_NUM_PINS; i++) { sysbus_init_irq(sbd, &s->irq[i]); } =20 @@ -422,7 +422,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **e= rrp) mapfn =3D pci_vpb_map_irq; } =20 - pci_bus_irqs(&s->pci_bus, pci_vpb_set_irq, mapfn, s->irq, 4); + pci_bus_irqs(&s->pci_bus, pci_vpb_set_irq, mapfn, s->irq, PCI_NUM_PINS= ); =20 /* Our memory regions are: * 0 : our control registers --=20 2.26.2 From nobody Thu May 9 23:52:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) client-ip=209.85.221.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1602445772; cv=none; d=zohomail.com; s=zohoarc; b=SWMR49LxiwOBRi3JZIzGETIGSJ6IbI9JzQxCq1hcHhG7A6C5z8v/ho3O5b58jBk70OkWuQWMLhFDK/SWElTPf6vJETFmtemf6NdSsj/2UtHowh05EoNQZM4oTfU9vxoD3u4m7t3AAHJvnFKm7U68czeOuL+DHvBk2SMF48VA7zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602445772; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JY3Ndr1SwLa4aQQZxdcgHQ230u1S4q1Vxx6foe4GpMc=; b=SchKOColIm/qE+3dhn6X8wgFNVVwkHB1rRzYzQTgCusCZFnFr3xh4s7GbA21yjKosopzU6io/e5oX6DVdPaqFh66qTT0YfBfJb6ZvgYUk7HEAP8aNt/xvtG+DKxgAcS2FnFRMwvRjYcK3KDjsqw02V6ueTo1TdRQ7LMjbpO2zDY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.zohomail.com with SMTPS id 1602445772313906.2900298820884; Sun, 11 Oct 2020 12:49:32 -0700 (PDT) Received: by mail-wr1-f66.google.com with SMTP id t9so16595011wrq.11 for ; Sun, 11 Oct 2020 12:49:31 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id i33sm23103929wri.79.2020.10.11.12.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 12:49:29 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=JY3Ndr1SwLa4aQQZxdcgHQ230u1S4q1Vxx6foe4GpMc=; b=b5U728+2oqLyxZLK4gVj4hJFF5c7HoW2X5d0QI2a87MHPnJgyvbKCwWg8T53YDnYO7 KjIgq/5JFyG0MP5wq7hPVoPsYn4moSSjhsha7EpKdldGOrhmmhvL2uzFc8buzf9qGKRI GjDSJCoiqrYM/+ChzcaJeyQ5965bSm8S0KR2iOM+1FbiKTntdQoOd4CrBxdzo/wuuSFs Qvx1VW69GKaxcgxgM1RmZNd6E51sagjsNXFhE+vLpEyn6VnPSZwmjClikToWDlsnR5Rj kIIuk65udgF1FRQzqHUR4nEJ0lgbU/ANVyeLdDkYfKv/xKdeSiY1zHgNeilymXP25Kt1 lWSw== 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:mime-version:content-transfer-encoding; bh=JY3Ndr1SwLa4aQQZxdcgHQ230u1S4q1Vxx6foe4GpMc=; b=lkuCx4vR3ed00SwABrjTqATlB8POFict95xHhrvsRHnE1FwC7O43r8CNbccnHEQ/k/ j3lpH42HZdyltdkn0gQsZnFfpLeod1N/LScPyzvrJQoyj2qs2Y4Y60Rnq4Nz+e268bW+ Vh7YDSc4LPhJFUVmCz/pnjtUTfazakEWACmp6G9f7fjHuYr5dnVMXQVff0uVbq6jcqUv XOT9cmkBd+TGMd/b4/X/o6uX+qMgt9W0PVwLA6LkwxD3xcJLdjF4lWZbSd74wz6l0xJi yJvRBQq3V0eg3zo6Q1cwL0XIMj/7HtlGV+CAY3DBk0W7w4xlSd/hezKh3sQtZvvoZ9B2 BQZg== X-Gm-Message-State: AOAM530Mhf2DVaZwjiTL+l5r7y+gETPfHEi2+QpPP9Q5bK6AHiP8VguI OTn0WgO7TK8fgSS57MMfXv8= X-Google-Smtp-Source: ABdhPJxhe4c/Rrv2QOxu3KWA6WEA0ZbB+4sMM43H46rAAHhqNpE96oGJiyinUINbzNT8ZV8E1p7JSw== X-Received: by 2002:a5d:4282:: with SMTP id k2mr24940583wrq.270.1602445770381; Sun, 11 Oct 2020 12:49:30 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Aleksandar Rikalo , Peter Maydell , Aurelien Jarno , Jiaxun Yang , Paolo Bonzini , Thomas Huth , Marcel Apfelbaum , Aleksandar Markovic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Laurent Vivier , qemu-trivial@nongnu.org Subject: [PATCH 2/4] hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value Date: Sun, 11 Oct 2020 21:49:16 +0200 Message-Id: <20201011194918.3219195-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201011194918.3219195-1-f4bug@amsat.org> References: <20201011194918.3219195-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Replace the magic '4' by ARRAY_SIZE(mem->alias) which is more explicit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/pam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index a4962057833..4712260025a 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -51,7 +51,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, start, size); =20 memory_region_transaction_begin(); - for (i =3D 0; i < 4; ++i) { + for (i =3D 0; i < ARRAY_SIZE(mem->alias); ++i) { memory_region_set_enabled(&mem->alias[i], false); memory_region_add_subregion_overlap(system_memory, start, &mem->alias[i], 1); --=20 2.26.2 From nobody Thu May 9 23:52:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) client-ip=209.85.128.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602445777; cv=none; d=zohomail.com; s=zohoarc; b=IBtOQ62mJNB8xpsRC4P9+me2dk5ty6ZCTLw383P5i60gSEvBjGFeR2QZ2l9IZ6zfc5tXfwxgzUncKA54dmf7+26pyHGcGjuMeEuwLOy6tuqZoCeKFwT+Q8PJbZFj9M3gC1EAO0oTTL1tDPRe3ZKxaNVCN7a93wEabLLVMo7BBv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602445777; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SDIyb5n7P2r5vl2AEidPZJyv8Pk8oGY5haZC+t+fmMk=; b=QmcrRAuPB1eezEZ/o0ri6DMAXR/NuK7pPNrpu5WuNdXr8ycVHREPBKSZWzIp2N60dUzTYJeqg6uYP8kt+fJQ65szXBpMA8LkH9WtKr+ddguL9Q8MoaelbrFqDLLEP1N4X7wPLDHwElBCSgSv9pN1ELE6DuIGgsCUEmG0FytMxUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.zohomail.com with SMTPS id 1602445777046799.7040490223148; Sun, 11 Oct 2020 12:49:37 -0700 (PDT) Received: by mail-wm1-f66.google.com with SMTP id l15so12526344wmh.1 for ; Sun, 11 Oct 2020 12:49:36 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id q4sm21420475wru.65.2020.10.11.12.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 12:49:34 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=SDIyb5n7P2r5vl2AEidPZJyv8Pk8oGY5haZC+t+fmMk=; b=cDmoeKgWEhFiacoidrflBcXHnqOYg2fZWCT64uknbTOf6DwQl432yKQk8edGKd33X3 Ka6ZlMMzDhBbAtq12cpQiCbWwQ2q0Ig409p66knzAnqReVGuyj47vOB35g4m9eC7rnr+ Q7hpBnf7+Wkx0KhRuSwaRpIShHDBHfblAiYdNLJsAcCrs4eJgjumb+PGpBgoel/DPq7i GDKZlrVSEigesebzAJlWe+NmVznPppB0J8c8DeUEsz30E6hWYozQHqgfY9yFpGjwd0oI fUL34wSs0M+32+SEZ4yJe+ycnhy+QCbVQ5JosUYLHS/GuDOcbHcDpbcTk8UAYLx2Kp6D HLKw== 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:mime-version:content-transfer-encoding; bh=SDIyb5n7P2r5vl2AEidPZJyv8Pk8oGY5haZC+t+fmMk=; b=oPviYX8/lgRVGMKvpYGWthLVqRlbRZQ2lwC580l7YPJIdKtUqfWqYPYEbtZnAEL7pd 1AwpoUrXPUM1CccxFgceYaT+l0/tX0pfvtkz7OO67uWHk8l4JOia7RXA4KmAwaiRcLMw PTrBRwcaYioc2vuvKdPG+NGpwvFxwz0DwGT0XJ/rb+YAn5FBS+Ajp0jom8ncO7q42Ktu WDfM0SR0IT03VEhsE3+T/OwzePJZe3Xrwm4R969UezvnsUcmHcr2uB1SGEo7494jcX/e D/JfXZPIOmCDSNE5e8KJvOJOznSKMufA8FQ7s/2RmkwLfzyAb5K9B0HDQtr33AxxmAfi iW+w== X-Gm-Message-State: AOAM533S767y+u8JLhVxVh2szF/THuV7sY/nQxfVro9l72HtEaYne2IY VmXyhjZshy3PL06+xLt3Auw= X-Google-Smtp-Source: ABdhPJyOpExsBJBvhmpoY5SXvj2cs4sQwfuU2ubJ778/DMTXlMvZ+HB1GZvm+Lx3hzLpfNl5JU9KSQ== X-Received: by 2002:a05:600c:216:: with SMTP id 22mr7490260wmi.149.1602445775112; Sun, 11 Oct 2020 12:49:35 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Aleksandar Rikalo , Peter Maydell , Aurelien Jarno , Jiaxun Yang , Paolo Bonzini , Thomas Huth , Marcel Apfelbaum , Aleksandar Markovic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Laurent Vivier , qemu-trivial@nongnu.org Subject: [PATCH 3/4] hw/pci-host/versatile: Add WINDOW_COUNT definition to replace magic '3' Date: Sun, 11 Oct 2020 21:49:17 +0200 Message-Id: <20201011194918.3219195-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201011194918.3219195-1-f4bug@amsat.org> References: <20201011194918.3219195-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Use self-explicit WINDOW_COUNT definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/versatile.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index b4951023f4e..4d9565de4b1 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -72,6 +72,8 @@ enum { PCI_VPB_IRQMAP_FORCE_OK, }; =20 +#define WINDOW_COUNT 3 + struct PCIVPBState { PCIHostState parent_obj; =20 @@ -86,18 +88,18 @@ struct PCIVPBState { * The offsets into pci_mem_space are controlled by the imap registers. */ MemoryRegion pci_io_window; - MemoryRegion pci_mem_window[3]; + MemoryRegion pci_mem_window[WINDOW_COUNT]; PCIBus pci_bus; PCIDevice pci_dev; =20 /* Constant for life of device: */ int realview; - uint32_t mem_win_size[3]; + uint32_t mem_win_size[WINDOW_COUNT]; uint8_t irq_mapping_prop; =20 /* Variable state: */ - uint32_t imap[3]; - uint32_t smap[3]; + uint32_t imap[WINDOW_COUNT]; + uint32_t smap[WINDOW_COUNT]; uint32_t selfid; uint32_t flags; uint8_t irq_mapping; @@ -130,7 +132,7 @@ static void pci_vpb_update_all_windows(PCIVPBState *s) /* Update all alias windows based on the current register state */ int i; =20 - for (i =3D 0; i < 3; i++) { + for (i =3D 0; i < WINDOW_COUNT; i++) { pci_vpb_update_window(s, i); } } @@ -148,8 +150,8 @@ static const VMStateDescription pci_vpb_vmstate =3D { .minimum_version_id =3D 1, .post_load =3D pci_vpb_post_load, .fields =3D (VMStateField[]) { - VMSTATE_UINT32_ARRAY(imap, PCIVPBState, 3), - VMSTATE_UINT32_ARRAY(smap, PCIVPBState, 3), + VMSTATE_UINT32_ARRAY(imap, PCIVPBState, WINDOW_COUNT), + VMSTATE_UINT32_ARRAY(smap, PCIVPBState, WINDOW_COUNT), VMSTATE_UINT32(selfid, PCIVPBState), VMSTATE_UINT32(flags, PCIVPBState), VMSTATE_UINT8(irq_mapping, PCIVPBState), @@ -371,12 +373,10 @@ static void pci_vpb_reset(DeviceState *d) { PCIVPBState *s =3D PCI_VPB(d); =20 - s->imap[0] =3D 0; - s->imap[1] =3D 0; - s->imap[2] =3D 0; - s->smap[0] =3D 0; - s->smap[1] =3D 0; - s->smap[2] =3D 0; + for (int i =3D 0; i < WINDOW_COUNT; i++) { + s->imap[i] =3D 0; + s->smap[i] =3D 0; + } s->selfid =3D 0; s->flags =3D 0; s->irq_mapping =3D s->irq_mapping_prop; @@ -453,7 +453,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **e= rrp) * PCI memory space. The sizes vary from board to board; the base * offsets are guest controllable via the IMAP registers. */ - for (i =3D 0; i < 3; i++) { + for (i =3D 0; i < WINDOW_COUNT; i++) { memory_region_init_alias(&s->pci_mem_window[i], OBJECT(s), "pci-vb= p-window", &s->pci_mem_space, 0, s->mem_win_size[i]); sysbus_init_mmio(sbd, &s->pci_mem_window[i]); --=20 2.26.2 From nobody Thu May 9 23:52:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602445781; cv=none; d=zohomail.com; s=zohoarc; b=L3BFDac4iSNvBAB+XwItieX4SBBUNgq4ZRw2IdNMRopcLDwIpSv3xu5sNPTG9MQU1M7yyxFaJK2EW7RWkyjAjEe8Q1FjUBL5CLsfNPLG8CFPzEl2UCVVpyS3fpI/8FqkmHGV+PXvtQwMNfkOUr52yVAH3gOvY0mL3X98o7HWmxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602445781; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h379DL5DmLfjV8PYLkjd7rlBL1BTLA1UsF5gCe/58yY=; b=SRdcDgMcimQL+egd+3/5bdloRR7YNL4SneD83x3HqZvb58+Wf9LT+d4gi2iMTFvh2vSR4qT9+BsoB6ZZD3sTEp9AIAMSLDQ8mn2dpvVjreYnOsdVoWXz69b1+7fYrJlU7WpUa0SyeMODYLmhEvlSx7gch6hoH7I/Si9BhTsNy+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 1602445781705327.4376610949056; Sun, 11 Oct 2020 12:49:41 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id f21so15250151wml.3 for ; Sun, 11 Oct 2020 12:49:41 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id f14sm23024055wrt.53.2020.10.11.12.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 12:49:39 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=h379DL5DmLfjV8PYLkjd7rlBL1BTLA1UsF5gCe/58yY=; b=bYzPu2mnrCz0oSVAMLCkTcw1nC+d1y7eurOU3zuPIslvaw/wnfx1Z1wGBBoNWfEmAB ycbJrvVOfG4MJoAh7Q2UqzOZ2jxR2D+htKX5rtTjQH2ogJKSLvjPzSVhr2LNkDNraDJ3 RZwixCsZ+iYOB1iGMhPLK+P3LNm68EU6TJfiqczhVP7eLMZRtGYkCXnHuQTK9ABRxcPr Q74mB92OAfc9u/32OhMYxt4NEzYcqaloNkXBawkDuVQMA8PKTXue3vlf4CLTcndMzu6W +/gA95u7XW35wnixpO3qfmERBZ7RauKnDI8YydBAUyyKPJyRUz28YiSLZd4BBBV0J6Yn zdQQ== 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:mime-version:content-transfer-encoding; bh=h379DL5DmLfjV8PYLkjd7rlBL1BTLA1UsF5gCe/58yY=; b=TTI/NAQjiXiDiCprpbxF8SMlXncTZSA4qP5bTO9PTdd1BzkTTWgkKf58zcaNczVK11 Ts+GWxJjjNhr81mdfzp7denHMS/yecL8ipyjh25P1Q3SgKu1ROI1E7Xqh2VMJiKl8cBw gu/SDYAWFtR2E8sEWHkj17ldsYRlPVhjtS9bT/HTPkObyjbAwuOI6hZU/FL7C9ZvqdeJ I5j6zM3+l7tE0WPKcQXb5y9U67FRlIUTqRwSBj4zhN4OQGOqaP/iN78eUYUwyp/GQAd4 fSFrDXW9U+E72XIRfjPij4LIQtzduhnirBBP5vXvAbRB2FUvBr07uS0plks99pWQ6cTa P8DA== X-Gm-Message-State: AOAM532h6bsa9Je7e3C04JUkXF+9Pq2tftJUKB3zOjdna2tiLtwTlItR RKk4LdlCJltXLbM//7/Wu8M= X-Google-Smtp-Source: ABdhPJxRXq2SOdDUOyfr1n/82jWNvIbfbd9pUl7GWKu8ocaSIFuPvp9YNSPAd78ylzrnSXgdjC4Ucw== X-Received: by 2002:a1c:7302:: with SMTP id d2mr8159827wmb.133.1602445779816; Sun, 11 Oct 2020 12:49:39 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Aleksandar Rikalo , Peter Maydell , Aurelien Jarno , Jiaxun Yang , Paolo Bonzini , Thomas Huth , Marcel Apfelbaum , Aleksandar Markovic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Laurent Vivier , qemu-trivial@nongnu.org Subject: [PATCH 4/4] tests/qtest: Replace magic value by NANOSECONDS_PER_SECOND definition Date: Sun, 11 Oct 2020 21:49:18 +0200 Message-Id: <20201011194918.3219195-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201011194918.3219195-1-f4bug@amsat.org> References: <20201011194918.3219195-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Use self-explicit NANOSECONDS_PER_SECOND definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- tests/qtest/rtc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c index c7af34f6b1b..402ce2c6090 100644 --- a/tests/qtest/rtc-test.c +++ b/tests/qtest/rtc-test.c @@ -292,7 +292,7 @@ static void alarm_time(void) break; } =20 - clock_step(1000000000); + clock_step(NANOSECONDS_PER_SECOND); } =20 g_assert(get_irq(RTC_ISA_IRQ)); --=20 2.26.2