{"id":2175101,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175101/?format=json","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.0/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20251217111510.138848-2-claudiu.beznea.uj@bp.renesas.com>","date":"2025-12-17T11:15:09","name":"[v2,1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9c507fda179410e697e64c255d72fc17fbf457a7","submitter":{"id":86830,"url":"http://patchwork.ozlabs.org/api/1.0/people/86830/?format=json","name":"Claudiu Beznea","email":"claudiu.beznea@tuxon.dev"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20251217111510.138848-2-claudiu.beznea.uj@bp.renesas.com/mbox/","series":[{"id":485663,"url":"http://patchwork.ozlabs.org/api/1.0/series/485663/?format=json","date":"2025-12-17T11:15:08","name":"PCI: rzg3s-host: Cleanups","version":2,"mbox":"http://patchwork.ozlabs.org/series/485663/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175101/checks/","tags":{},"headers":{"Return-Path":"\n <linux-pci+bounces-43165-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=tuxon.dev header.i=@tuxon.dev header.a=rsa-sha256\n header.s=google header.b=l2bVoHxk;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-43165-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev\n header.b=\"l2bVoHxk\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.218.50","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=tuxon.dev","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=tuxon.dev"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dWWRw58K1z1y3Z\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 17 Dec 2025 22:15:24 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 1CB543019E36\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 17 Dec 2025 11:15:22 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DD55D33D6CE;\n\tWed, 17 Dec 2025 11:15:18 +0000 (UTC)","from mail-ej1-f50.google.com (mail-ej1-f50.google.com\n [209.85.218.50])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id C4EDD33B955\n\tfor <linux-pci@vger.kernel.org>; Wed, 17 Dec 2025 11:15:16 +0000 (UTC)","by mail-ej1-f50.google.com with SMTP id\n a640c23a62f3a-b79e7112398so1101919366b.3\n        for <linux-pci@vger.kernel.org>; Wed, 17 Dec 2025 03:15:16 -0800 (PST)","from claudiu-X670E-Pro-RS.. ([82.78.167.134])\n        by smtp.gmail.com with ESMTPSA id\n a640c23a62f3a-b7cfa2e817csm1933465066b.19.2025.12.17.03.15.13\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Wed, 17 Dec 2025 03:15:14 -0800 (PST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1765970118; cv=none;\n b=IVlKYgfmL07tjrlEroP+Bc2HFSd2cTZyGjdHhWpNYhbnFmCTWee7jD7YlpuqPLkXpWxnKa0bSDAxa1kXIV84KGK4sHQDcszOmMNW2/uCue0JUEbbkBri2AY+Sp/36ss48pERX2qQuro9kjLuurl1hwM8I4n/IP03czXuxaaIwow=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1765970118; c=relaxed/simple;\n\tbh=tELzXXkk4oo6zBbXVS1TJTiw2ptFpzmnNZxBUTbCsk0=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Qw68lsMUUN7lQEq4czYsVQ2ewWbW0sgcq9LCYZ/62671wx2Rg8YrC8i1K7dcxu+1/qzbnCBCxcelPiX0uidRg0n8q6aTCZdPYuMQ44ONdoQArUGVxgxfMyaoAKBLrRwmFndHAk+Y7n7z2cZL+rC25YRrMXp6CK1RUwXvSziMfSU=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=tuxon.dev;\n spf=pass smtp.mailfrom=tuxon.dev;\n dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev\n header.b=l2bVoHxk; arc=none smtp.client-ip=209.85.218.50","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=tuxon.dev; s=google; t=1765970115; x=1766574915;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=5wDUddDoFILHwCBU7oSL38U5bGT7x1S1Cv5uHbCqjv8=;\n        b=l2bVoHxkeH9M7i93YuQQe/CxE3jTKVqBPC/yaaRWqK44HCNB808mZ1ndAn8X0NcZpR\n         DQHK4RvyDTKZvUiUKEAXkxdMZKwYZcTPs29YBsWi3YUH6QXJJdvOKLeXaGrEknVkMPJT\n         Gx25BiInstmrpC/xiGKMnvIdGZHAKkkQlP1TABSvCtjullVwUj3GTWaGEwGrmFz/tLwR\n         v5zpGM8jwqtLCcpP6YaBdv92cNbCRdKa4N4F4uVW6j3Upg9ypmudRK8zdDUP4HRgVHux\n         hmgdyUZTCqiWXoCHP0DqvJwoo3RYZw2iE1cMYkp3D0L8osMk5dRVGHEcHBEshPadQCTV\n         CNJw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20230601; t=1765970115; x=1766574915;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=5wDUddDoFILHwCBU7oSL38U5bGT7x1S1Cv5uHbCqjv8=;\n        b=t8gj52bfGWQyWklxQ3ZHjaEwfoAOh8fv7phBG8Nzl98ukMjrrE+fDTtPa8kXSrFK9s\n         1gAbvj8ulncuNgYu3zbrckmdphpHhxU+3Awe/PkjE4qbk/ieBje1EqdKEvnQI4KZliPG\n         3kNpnLdpo0USza/jpCCzvSIaYgQ6QVL6HVJxHa6DRUjX4ryIKN7yTQxhYZlujN/P8n+9\n         aTots5OSddAEHkZTI/k0oCNoFF4QqTLxMVaVPrdVSkSdvZpzbAytHPEJEp0QhMZvTEOw\n         Tb81KyGNasYTDynchhd34aJOYOUo1Jowf0WEN+7X1yNI6Ham/KbS2Fuj0BZo5ltJvBjW\n         3atA==","X-Forwarded-Encrypted":"i=1;\n AJvYcCVq3GkEX+P8mEZsGIbrtkav176bggKkY6bNvB7T07TQ4mjl1kXB+w+RvLHS3cgvkNW/MW0G4UYPZDs=@vger.kernel.org","X-Gm-Message-State":"AOJu0YywIsekA2iaF0mcMYuzx/O7Ar4SH7HYnTawxIQoLtVI2wPrGNFD\n\tciUcKDwZzBQt5as/F2JGIsLT4Unqyj8PeeUtYJbq70K9G8Hq0fZzTMubAUcSaX3DvQo=","X-Gm-Gg":"AY/fxX7tBQ3weRwcqbwfjp938hEWCDtIo7V9inF9rQOHpwZqL3rBHgbZE4f7K8OaSKO\n\t4VKQOa1LIKRN8oOUozBYg+Q89Wo0+48Wn1Smql2j6+9GKLSs5Ilnm/g6JEXUn+iw8A6HmpOnuTI\n\t16DfdtsbUDlTBWISDun0SUTiIGw30+JMIa1abWT3s7HfZ0st8uuMu9f1yvyYkrjsDmGepPeLkxz\n\tsh128Sngx9GO4Iz0ahjtSXBqTDGedagBR/BAUO+HWdcrE1F7iw6rr28hnA1uR7AgqfvG6FdLRhw\n\t3tgZM9fIkx751lGb7ER9qxYh3dL3pENyCozHHtr18JWKvSRACbW0NH3x/u35j1rtyrhLgyLXvyX\n\tpK5OZn4exBzEsEmbhCnECnXLCNRygVTbNGSQX6EpuPdhxTJFVA2d0o/XTcFqUP0FJBPMtluBxFU\n\tF9bZvLeVnUwLhDZ+BDPYMXRrPx3SHroHmVvVegH3aIIWWjqzi12zQ=","X-Google-Smtp-Source":"\n AGHT+IFn0YqbxgiZtiVRkJ+QtMmjGYmLvsJLkNrhsbqEX9TV5iWWuHuT6ttcHc//6S4/IzyW9RNJew==","X-Received":"by 2002:a17:907:1ca1:b0:b73:75ea:febf with SMTP id\n a640c23a62f3a-b7d23a7581dmr1722711766b.55.1765970114962;\n        Wed, 17 Dec 2025 03:15:14 -0800 (PST)","From":"Claudiu <claudiu.beznea@tuxon.dev>","X-Google-Original-From":"Claudiu <claudiu.beznea.uj@bp.renesas.com>","To":"bhelgaas@google.com,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tmani@kernel.org,\n\trobh@kernel.org","Cc":"claudiu.beznea@tuxon.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-renesas-soc@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"[PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for\n the root bus","Date":"Wed, 17 Dec 2025 13:15:09 +0200","Message-ID":"<20251217111510.138848-2-claudiu.beznea.uj@bp.renesas.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20251217111510.138848-1-claudiu.beznea.uj@bp.renesas.com>","References":"<20251217111510.138848-1-claudiu.beznea.uj@bp.renesas.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>\n\nThe Renesas RZ/G3S host controller allows writing to read-only PCIe\nconfiguration registers when the RZG3S_PCI_PERM_CFG_HWINIT_EN bit is set in\nthe RZG3S_PCI_PERM register. However, callers of struct pci_ops::write\nexpect the semantics defined by the PCIe specification, meaning that writes\nto read-only registers must not be allowed.\n\nThe previous custom struct pci_ops::write implementation for the root bus\ntemporarily enabled write access before calling pci_generic_config_write().\nThis breaks the expected semantics.\n\nRemove the custom implementation and simply use pci_generic_config_write().\n\nAlong with this change, the updates of the PCI_PRIMARY_BUS,\nPCI_SECONDARY_BUS, and PCI_SUBORDINATE_BUS registers were moved so that\nthey no longer depends on the RZG3S_PCI_PERM_CFG_HWINIT_EN bit in the\nRZG3S_PCI_PERM_CFG register, since these registers are R/W.\n\nFixes: 7ef502fb35b2 (\"PCI: Add Renesas RZ/G3S host controller driver\")\nSuggested-by: Bjorn Helgaas <helgaas@kernel.org>\nSigned-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>\n---\n\nChanges in v2:\n- added fixes tag\n\n drivers/pci/controller/pcie-rzg3s-host.c | 27 ++++--------------------\n 1 file changed, 4 insertions(+), 23 deletions(-)","diff":"diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c\nindex 83ec66a70823..ae6d9c7dc2c1 100644\n--- a/drivers/pci/controller/pcie-rzg3s-host.c\n+++ b/drivers/pci/controller/pcie-rzg3s-host.c\n@@ -439,28 +439,9 @@ static void __iomem *rzg3s_pcie_root_map_bus(struct pci_bus *bus,\n \treturn host->pcie + where;\n }\n \n-/* Serialized by 'pci_lock' */\n-static int rzg3s_pcie_root_write(struct pci_bus *bus, unsigned int devfn,\n-\t\t\t\t int where, int size, u32 val)\n-{\n-\tstruct rzg3s_pcie_host *host = bus->sysdata;\n-\tint ret;\n-\n-\t/* Enable access control to the CFGU */\n-\twritel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN,\n-\t\t       host->axi + RZG3S_PCI_PERM);\n-\n-\tret = pci_generic_config_write(bus, devfn, where, size, val);\n-\n-\t/* Disable access control to the CFGU */\n-\twritel_relaxed(0, host->axi + RZG3S_PCI_PERM);\n-\n-\treturn ret;\n-}\n-\n static struct pci_ops rzg3s_pcie_root_ops = {\n \t.read\t\t= pci_generic_config_read,\n-\t.write\t\t= rzg3s_pcie_root_write,\n+\t.write\t\t= pci_generic_config_write,\n \t.map_bus\t= rzg3s_pcie_root_map_bus,\n };\n \n@@ -1065,14 +1046,14 @@ static int rzg3s_pcie_config_init(struct rzg3s_pcie_host *host)\n \twritel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00L);\n \twritel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00U);\n \n+\t/* Disable access control to the CFGU */\n+\twritel_relaxed(0, host->axi + RZG3S_PCI_PERM);\n+\n \t/* Update bus info */\n \twriteb_relaxed(primary_bus, host->pcie + PCI_PRIMARY_BUS);\n \twriteb_relaxed(secondary_bus, host->pcie + PCI_SECONDARY_BUS);\n \twriteb_relaxed(subordinate_bus, host->pcie + PCI_SUBORDINATE_BUS);\n \n-\t/* Disable access control to the CFGU */\n-\twritel_relaxed(0, host->axi + RZG3S_PCI_PERM);\n-\n \treturn 0;\n }\n \n","prefixes":["v2","1/2"]}