From patchwork Sun Oct 11 19:49:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 271553 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C6DC433E7 for ; Sun, 11 Oct 2020 19:52:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D5E92087D for ; Sun, 11 Oct 2020 19:52:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fchLa3yE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D5E92087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRhNw-00052E-7r for qemu-devel@archiver.kernel.org; Sun, 11 Oct 2020 15:52:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRhLX-0002x1-3b; Sun, 11 Oct 2020 15:49:32 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRhLT-0000HW-Vr; Sun, 11 Oct 2020 15:49:29 -0400 Received: by mail-wm1-x343.google.com with SMTP id j136so15371696wmj.2; Sun, 11 Oct 2020 12:49:26 -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=isYmbhHzWSYxS4hT958WWAU7uDJiGNgjZj+Xdwe3CdR2pkGGeKQP2188p7Akm4lcja 8kfGs6qSHu1QYBwRldey8IiGm9yxzBKnF7xufbvmFK/hcQW6sLiS3ao0TpniBkVxSLe2 KQ3kjunsWd4Ll2jHfCqMWxgWZEGADgsEroPoKFZmTHClH6sxiLlaeibzMdTZDXdZeL6s CXs1/2YeAXmYGHqlfcpcivNaEWa7dm8EuRi0S6XNF75kIC/SOIzdMd9ePJ4yqloM5n+E vnXSKXN3FpfCzn5YBqSebm0G4TnRS+h80RbYZdk+F/1vwVTY772sMOiQvtRKonmDsJoc Whrw== X-Gm-Message-State: AOAM532tXmVnhlFE+LtI71o3O+KJMHUjgB4LZddeZFqKt+nARvZ8uQtC v8OX2d9DZf4aty8sM/J781qjc+jFcac= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@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 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , Aleksandar Rikalo , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , qemu-arm@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use self-explicit PCI_NUM_PINS definition instead of magic value. Signed-off-by: Philippe Mathieu-Daudé --- 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 VirtMachineState *vms, int first_irq, const char *nodename) { int devfn, pin; - uint32_t full_irq_map[4 * 4 * 10] = { 0 }; + uint32_t full_irq_map[4 * PCI_NUM_PINS * 10] = { 0 }; uint32_t *irq_map = full_irq_map; for (devfn = 0; devfn <= 0x18; devfn += 0x8) { - for (pin = 0; pin < 4; pin++) { + for (pin = 0; pin < PCI_NUM_PINS; pin++) { int irq_type = GIC_FDT_IRQ_TYPE_SPI; int irq_nr = first_irq + ((pin + PCI_SLOT(devfn)) % PCI_NUM_PINS); int irq_level = 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 it. */ pic_level = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < PCI_NUM_PINS; i++) { if (pic_irq == piix4_dev->config[PIIX_PIRQCA + i]) { pic_level |= 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; - 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 **errp) object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_HOST); - for (i = 0; i < 4; i++) { + for (i = 0; i < PCI_NUM_PINS; i++) { sysbus_init_irq(sbd, &s->irq[i]); } @@ -422,7 +422,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp) mapfn = pci_vpb_map_irq; } - 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); /* Our memory regions are: * 0 : our control registers From patchwork Sun Oct 11 19:49:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F875C433E7 for ; Sun, 11 Oct 2020 19:54:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 340782087D for ; Sun, 11 Oct 2020 19:54:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b5U728+2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 340782087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRhQE-0000CT-9B for qemu-devel@archiver.kernel.org; Sun, 11 Oct 2020 15:54:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRhLc-0002z9-Rg; Sun, 11 Oct 2020 15:49:38 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRhLZ-0000Hz-Em; Sun, 11 Oct 2020 15:49:35 -0400 Received: by mail-wr1-x441.google.com with SMTP id e17so16582133wru.12; Sun, 11 Oct 2020 12:49:31 -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=kwqtw+tBcBT+ygASApoUBPyoU+R/G3CvPpxXHWyN7xicpQyCYMf/vZlMnhwnaNLcZN /DzMqoZayQutH70CttUKzRW4OnC/v0MWnhdvSlRuTv8OAkxj+EWW2lkGtjbuI9chWF3P aaKrtz1X0fv15n2ysWCz496COzU1TG62rImqHm4iPrc+/RwRSCT0qCo2/DKM8H2ITvxY j/Iei4PVcFtKci5K7s7OOMq+jEw68fiaOWXMuojvSEwm+yNyvP1f8aoq46WECiPXmGxF tjZGpZW2POHMao+qzWKmR0Rrs6RyfaMa20NE7w+BbnCR1NTMCavpTHOm0HR61i7qcqXt QsRA== X-Gm-Message-State: AOAM5309QbNYX8niMqNE1d9Rwca1qupmQ24rUc1wvKrV9XbX9+fEhFe+ PO40fhdhwf2XQnnWhMbWEXL7xYFivDY= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@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 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , Aleksandar Rikalo , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , qemu-arm@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Replace the magic '4' by ARRAY_SIZE(mem->alias) which is more explicit. Signed-off-by: Philippe Mathieu-Daudé --- 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); memory_region_transaction_begin(); - for (i = 0; i < 4; ++i) { + for (i = 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); From patchwork Sun Oct 11 19:49:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 271551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F888C433E7 for ; Sun, 11 Oct 2020 19:55:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A656A2087D for ; Sun, 11 Oct 2020 19:55:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cDmoeKgW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A656A2087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRhRX-0001ue-QQ for qemu-devel@archiver.kernel.org; Sun, 11 Oct 2020 15:55:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRhLg-00030m-Jr; Sun, 11 Oct 2020 15:49:40 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:38528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRhLd-0000IS-8m; Sun, 11 Oct 2020 15:49:39 -0400 Received: by mail-wm1-x342.google.com with SMTP id b127so2544481wmb.3; Sun, 11 Oct 2020 12:49:36 -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=i/cYADAY7ymzhNOY/4PhIPJD7u8T4LYjXW6CFeG1BSwtPefuWziMqPox5L8vpjm5sd NPXe6kUck+XjdQ2LNIS2Yz8ujZAF2aFGUQRUnbg+yCwEPgz7rWCK5yIDmPKkI4XDWZfH hxPkAn/LH1JTXhT/oRNrdwrCqu0GiZh4hzwnwEvm8JcCl5I9Kms82taCKZ+3iyVgpu6g K0yjxHlw+ZDma1B5zIs598b1bvi6JSrNDqa6lmRIxu5RT5hQo2O+pa/dKo8hx7YxhgA4 ymJZVslwIyL8uoxiT5VCZpgy/J1mpy4wx/o4XQ5kMpQvDfRXbDjywpubJl6PgyPL+sGv j7Wg== X-Gm-Message-State: AOAM530d6HlS3WAGNeM+MWlxD1Ve7h1v+VNfHsU5QkhhBAxO6dQwhRtv jMvUab5QuQBaC561Ov8/6HUweQtaWGI= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@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 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , Aleksandar Rikalo , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , qemu-arm@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use self-explicit WINDOW_COUNT definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daudé --- 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, }; +#define WINDOW_COUNT 3 + struct PCIVPBState { PCIHostState parent_obj; @@ -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; /* 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; /* 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; - for (i = 0; i < 3; i++) { + for (i = 0; i < WINDOW_COUNT; i++) { pci_vpb_update_window(s, i); } } @@ -148,8 +150,8 @@ static const VMStateDescription pci_vpb_vmstate = { .minimum_version_id = 1, .post_load = pci_vpb_post_load, .fields = (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 = PCI_VPB(d); - s->imap[0] = 0; - s->imap[1] = 0; - s->imap[2] = 0; - s->smap[0] = 0; - s->smap[1] = 0; - s->smap[2] = 0; + for (int i = 0; i < WINDOW_COUNT; i++) { + s->imap[i] = 0; + s->smap[i] = 0; + } s->selfid = 0; s->flags = 0; s->irq_mapping = s->irq_mapping_prop; @@ -453,7 +453,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp) * PCI memory space. The sizes vary from board to board; the base * offsets are guest controllable via the IMAP registers. */ - for (i = 0; i < 3; i++) { + for (i = 0; i < WINDOW_COUNT; i++) { memory_region_init_alias(&s->pci_mem_window[i], OBJECT(s), "pci-vbp-window", &s->pci_mem_space, 0, s->mem_win_size[i]); sysbus_init_mmio(sbd, &s->pci_mem_window[i]); From patchwork Sun Oct 11 19:49:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01BC9C433DF for ; Sun, 11 Oct 2020 19:56:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D4D22087D for ; Sun, 11 Oct 2020 19:56:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bYzPu2mn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D4D22087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRhRw-0002Jl-PD for qemu-devel@archiver.kernel.org; Sun, 11 Oct 2020 15:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRhLn-00037m-DD; Sun, 11 Oct 2020 15:49:49 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRhLj-0000Is-IG; Sun, 11 Oct 2020 15:49:45 -0400 Received: by mail-wm1-x343.google.com with SMTP id a72so4667804wme.5; Sun, 11 Oct 2020 12:49:40 -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=TIortcG9cQCGCnSF1i5HQOHO2PpaA+97SYKCZH1feqw6UxsTelnatmtdxLZCLWByoe AUTS8paA1JXELK/xpWcT3TMP3fO57/O4KGBaBB5k6MAsP77P+RIt0FqFFQr4xuxVec5y laYMz4P7iGVMAbE/JIGVjIzYeBO/fh4q6NBk6dkeOAZ2T0YPsckLhUxtMQv3dk7Vp4me gen8Mk1OncSMYr7YxZTCTizEsW+TlMxo8nJStnXHi7O54WqnjDZHdKbSqqBFD9CARgOu 3EUrKfxapSwEmxN229N/CjAKf5xp6bV1WmzvpQLMuoE4UqkoL3qnJDeHAK4aGL5BqSF0 mnVA== X-Gm-Message-State: AOAM530lQkEIcqbeL/Otpt7ykw/tz2s1O9rah7LrJTQNuEAx6nMPGtWa OsJuWYPAgmOJLf2SKKkoisihFBAn7bk= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@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 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , Aleksandar Rikalo , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , qemu-arm@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use self-explicit NANOSECONDS_PER_SECOND definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daudé 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; } - clock_step(1000000000); + clock_step(NANOSECONDS_PER_SECOND); } g_assert(get_irq(RTC_ISA_IRQ));