From nobody Tue Nov 26 20:18:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1704669417; cv=none; d=zohomail.com; s=zohoarc; b=CL8rXRMA55Q97HHaV8ZkgBjpznbJoSR0qBQ9jcavlVLBIVIpRsYFGFL3J/JHFWPcufQxfCcx8XvgzjRs9vz1pf+XaAN7Kv+snYaPZdvqbQMW4wwbfSBqtIpBMHuQoKxqJ3oYCKhF3SDta32cYFjb338M4SXXJD2DzcRnOPrCw4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704669417; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6jsVDJtLEm1lPndCJvtY3GO9mpTGY2wxwxo3LuOR4oE=; b=k8CyW39jY3h0pR0xFjEA1B65QKA235VzW2cP5kTllTKRc9QHuvRSQdBi3iGjx/dNddFnkzHnJ8xZ9renKFLHzkZ30vLS0cuvKCRk1rMIx8H2G8ZcYC/+OvZ/7a5armzrIt2jbqYULsJzAHmKha/fsNBbKeCphJSUXvS8OkPJqwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1704669417958654.7193001627577; Sun, 7 Jan 2024 15:16:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.662934.1032844 (Exim 4.92) (envelope-from ) id 1rMcNg-0003M6-Hx; Sun, 07 Jan 2024 23:16:36 +0000 Received: by outflank-mailman (output) from mailman id 662934.1032844; Sun, 07 Jan 2024 23:16:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rMcNg-0003Lz-F9; Sun, 07 Jan 2024 23:16:36 +0000 Received: by outflank-mailman (input) for mailman id 662934; Sun, 07 Jan 2024 23:16:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rMcNf-0003Lm-7C for xen-devel@lists.xenproject.org; Sun, 07 Jan 2024 23:16:35 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cbecb944-adb2-11ee-9b0f-b553b5be7939; Mon, 08 Jan 2024 00:16:33 +0100 (CET) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50e7e55c0f6so1047359e87.0 for ; Sun, 07 Jan 2024 15:16:33 -0800 (PST) Received: from localhost.localdomain (dynamic-077-191-044-194.77.191.pool.telefonica.de. [77.191.44.194]) by smtp.gmail.com with ESMTPSA id p9-20020a17090635c900b00a27eddc3dcbsm3338834ejb.198.2024.01.07.15.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 15:16:31 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cbecb944-adb2-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704669393; x=1705274193; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6jsVDJtLEm1lPndCJvtY3GO9mpTGY2wxwxo3LuOR4oE=; b=TrGqEa6XVWszGUL3Rm7pOFjyhpxAA7bNlDjEoK7TDSuOyG3iWnkXhEw6sAFmjX5f1p SZKsnsJGNqBV3be1isrYkfPPEr18vCkhTYG1souXrg0YldZ+DerZSrJoLRG2cQqhUPXM 1gNbubE74i5RNG9Xv3rNg2BOXsT2S7iiXVc+4viQxDN9TkOtptnnAa5t3/A3ml24xij7 4adVsH7CoVXDKkzACWpXyY3VQbkxu6QZd6tCNRNvWOdsUDo8EXSdu3OHsxzeuOgONEZa LAd++kvdlw6Ai//qLI4tEfvPYPC8LlK5U0+o06vTUaJY+QOondWPYChqd/nQ2ZYxa046 6czg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704669393; x=1705274193; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6jsVDJtLEm1lPndCJvtY3GO9mpTGY2wxwxo3LuOR4oE=; b=mhAB/oJMnyjexH4gbbTQ//lZ/8X2ppEyg9NNTIrdMVpNmjEp95oaJQkIDBgxvWxZxn osxT0Ym7HTIsMt8JN9sbcPFV8YW7YM/CCQ24/bfStcjKnbj/PQQozMKfeg8/p4n4ktUf NNT0VEwQZi86WZLU1A+VGNT0RC5WSnmiOUfjquyk4uD3nWVZn0eYtxOb/hACy/zYr4Vz F3Mr12Gl1WRHrMz3EDXFddrRVpG30hNphjbTfhxxHllhiDMaN5RzaugVyVw6j2cD3iiH fW9CyhV7+0rDMWVOzOwYPR3O9Svch2ZHeuYDtONymv38fTGLrsnzgksMH9l5NcK9hLZx +mMg== X-Gm-Message-State: AOJu0YzOw/7hR8jWZHQfwLYV9Vh8gQfPW4ZXUz3BFWr8oZnup82XH2gC vDxBG9fkvQ7E90gN1IevY78= X-Google-Smtp-Source: AGHT+IHk2KwjckC2+0MPqdilUMmvonza/ii8ds1d+gqApYYQ7ahD486c6CLaIVQh3OrzE2iSYbke6w== X-Received: by 2002:a05:6512:39ce:b0:50b:f1ca:e6a with SMTP id k14-20020a05651239ce00b0050bf1ca0e6amr610420lfu.48.1704669392392; Sun, 07 Jan 2024 15:16:32 -0800 (PST) From: Bernhard Beschow To: 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 , Bernhard Beschow Subject: [PATCH] hw/i386/pc_piix: Make piix_intx_routing_notifier_xen() more device independent Date: Mon, 8 Jan 2024 00:16:23 +0100 Message-ID: <20240107231623.5282-1-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1704669418592100001 Content-Type: text/plain; charset="utf-8" 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 cod= e 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 exer= cise for now. Signed-off-by: Bernhard Beschow Reviewed-by: David Woodhouse Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 *d= ev) { int i; =20 - /* Scan for updates to PCI link routes (0x60-0x63). */ + /* Scan for updates to PCI link routes. */ for (i =3D 0; i < PIIX_NUM_PIRQS; i++) { - uint8_t v =3D dev->config_read(dev, PIIX_PIRQCA + i, 1); - if (v & 0x80) { - v =3D 0; - } - v &=3D 0xf; + const PCIINTxRoute route =3D pci_device_route_intx_to_irq(dev, i); + const uint8_t v =3D route.mode =3D=3D PCI_INTX_ENABLED ? route.irq= : 0; xen_set_pci_link_route(i, v); } } --=20 2.43.0