From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5E56BC4707B for ; Mon, 8 Jan 2024 12:15:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMoWu-0007GC-4L; Mon, 08 Jan 2024 07:14:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMoWs-0007G2-Mg for qemu-devel@nongnu.org; Mon, 08 Jan 2024 07:14:54 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMoWb-0002bF-NU for qemu-devel@nongnu.org; Mon, 08 Jan 2024 07:14:54 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40d89446895so10160675e9.0 for ; Mon, 08 Jan 2024 04:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704716075; x=1705320875; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pTv62+lrN+LJDOyyZzZUKji6+pubYOy60kmzZvHd3z4=; b=cYoPlX0UJmGiGL4YY5WkdNsVr6C2yAwTEWbgCEyCUGO5+FRZR7siv4sSkQCYBRPATV Mm4zjKSUCaPSv0AFQQR4hJdDLx09bL3nSevoKAbnaphOQ6pkKeA8wM+QrziesdwlZQZP 3169mCsETnpzOYL3mVnF6rMAusC8YDl/V6OYEDy26/bnzwATueIDf3cKgQIBBvXSibD0 MftdImAhQOMexGMZTzeEUHK9VtslPsmlbvFWHlCVl/+jumYf93UugkQ6FLb/yqIdzeEf ssvK8RSeOM6txFAnmfC0HYEXV6NssdG+Aa1wkdTFhJDYGixYLqliHyR8+loX1tzIjFzr mv4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704716075; x=1705320875; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pTv62+lrN+LJDOyyZzZUKji6+pubYOy60kmzZvHd3z4=; b=HIb+OzIRsbJHKgy3f4BwQT7W+SB9VMKR9Mm21hSagd7cKmJKl39jm9APtxV9LLF1va feZnabLe9eXzY3YIfyPANytxTNHwU4zpoSmpOKEcGdbY6udf3xY84kaghhSMlo2DwTtm fGbRfoHXn4szfQuSSvDGEAeIlas3zKmoPxOFO4trvZy+YrvVleTvJs0DuSdtoP+rdZOB WssC0P7R4es6aPeAe7zmkdgH02XYK9ZTE2h6eUUaHeIINUtSCV+RWdKnvUUJOFcn8qTq 1A0D3w3ONGbuEEogbBmh0HBI5ftwfEaQ9XlCAoCMpc8fG/B19EE2iSciNQgikNoGrnX3 ms7w== X-Gm-Message-State: AOJu0Ywot5/NftbP3GC9aheYAsBBqlncqzAYrvQXxfb73UTa0+M/aTlN yTjyGxy+0udzbQsu5XCRGpR3OuovwNKJ3w== X-Google-Smtp-Source: AGHT+IGxCyPZI3LhIKghuQNTCsPq8RlSvMV1g4746yYM5AkZRdonIiznbdeKS14OHtcSSqqKiec3+g== X-Received: by 2002:a7b:c8c3:0:b0:40d:8a57:796e with SMTP id f3-20020a7bc8c3000000b0040d8a57796emr1691872wml.154.1704716075055; Mon, 08 Jan 2024 04:14:35 -0800 (PST) Received: from [192.168.1.102] ([176.176.175.62]) by smtp.gmail.com with ESMTPSA id i11-20020a5d558b000000b003367bb8898dsm7625577wrv.66.2024.01.08.04.14.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jan 2024 04:14:34 -0800 (PST) Message-ID: Date: Mon, 8 Jan 2024 13:14:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hw/i386/pc_piix: Make piix_intx_routing_notifier_xen() more device independent Content-Language: en-US To: Bernhard Beschow , qemu-devel@nongnu.org Cc: Chuck Zmudzinski , Paolo Bonzini , Stefano Stabellini , xen-devel@lists.xenproject.org, David Woodhouse , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Paul Durrant , Richard Henderson , Anthony PERARD References: <20240107231623.5282-1-shentey@gmail.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= In-Reply-To: <20240107231623.5282-1-shentey@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 8/1/24 00:16, Bernhard Beschow wrote: > This is a follow-up on commit 89965db43cce "hw/isa/piix3: Avoid Xen-specific > variant of piix3_write_config()" which introduced > piix_intx_routing_notifier_xen(). This function is implemented in board code but > accesses the PCI configuration space of the PIIX ISA function to determine the > PCI interrupt routes. Avoid this by reusing pci_device_route_intx_to_irq() which > makes piix_intx_routing_notifier_xen() more device-agnostic. > > One remaining improvement would be making piix_intx_routing_notifier_xen() > agnostic towards the number of PCI interrupt routes and move it to xen-hvm. > This might be useful for possible Q35 Xen efforts but remains a future exercise > for now. > > Signed-off-by: Bernhard Beschow > --- > hw/i386/pc_piix.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index 042c13cdbc..abfcfe4d2b 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -92,13 +92,10 @@ static void piix_intx_routing_notifier_xen(PCIDevice *dev) > { > int i; > > - /* Scan for updates to PCI link routes (0x60-0x63). */ > + /* Scan for updates to PCI link routes. */ > for (i = 0; i < PIIX_NUM_PIRQS; i++) { > - uint8_t v = dev->config_read(dev, PIIX_PIRQCA + i, 1); > - if (v & 0x80) { > - v = 0; > - } > - v &= 0xf; > + const PCIINTxRoute route = pci_device_route_intx_to_irq(dev, i); This indeed dispatch to piix_route_intx_pin_to_irq(). Reviewed-by: Philippe Mathieu-Daudé > + const uint8_t v = route.mode == PCI_INTX_ENABLED ? route.irq : 0; > xen_set_pci_link_route(i, v); > } > }