Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1652561pxy; Thu, 6 May 2021 12:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIj7ZzvPWRfkObD0mZxwv7nDJehaV7ZSuYX8LBlenLtceDUl4NvK0y1ueB+jTUcc19L3wV X-Received: by 2002:a17:90b:1d8f:: with SMTP id pf15mr6333024pjb.36.1620328997192; Thu, 06 May 2021 12:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620328997; cv=none; d=google.com; s=arc-20160816; b=yUBDxT9Lh2iejGmkcAk/f7Dv57t+Tbr9GVQl+aYHxkVTmbY9BqjxUBTUUW8FnUMlXh QYBs6yGH6oYdW6nuUKCJZ9ctdHYZiBqdH/Dc7KpChXI8jVE//yp2lwo6ZybTexjiJMQp 8T8xGKrikkNISQVrmxd7CUjx6D7pXVDLuK02GV11a4SvNLD8oluajUHhZe+ch+f0IXsE XEYTC6/iASzOPkPTsRdW3jg3xVG56CvqCn/pR7isT+UaRvBT0e0eP+J4MGaO9K56H5KG z/uOL9nL26UsWcNfm1fKCGJzGSsGTqGphNIaKAfp6VtxJYiyw5rbQIaThvgYmeUpovwE vaaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YIw8yszMwbjw+oJPwpNAYSdMmkV96s/dYdlX6MksGOg=; b=ULWGrNheB/5FOofuBk8IJk/aysVstPXW09zvkdelnDvH3xoc5d7EzohgvU90o6+JZ2 mIo3uE1DqNn2G33kj6gwgZdcwKHwJLBeE36k3CpI7FfgUvxdfoV7xSn8UPVLtVjyZ2Ba Jy/PF1woVcWPzXiyzEYqeF1WRm3m4wOOcq44VbD3DuGAE75guxZQgIvFu72/CYz87Pj+ Tfih8Sb8uhvPm8uTp8wHtiwz45zbavc8xJJax69EgjQ+Kds3nX5Uk9ESieWhyv2IkKsa QqQ13yPAx7qjR8JZk7Gd7UHCYIvb7NlDbQKNPWQcj2yvflSzVzLkEJ9Qap4n7bA1tJao cEIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ngm8BGD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si3701225pll.206.2021.05.06.12.23.04; Thu, 06 May 2021 12:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ngm8BGD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236085AbhEFPh4 (ORCPT + 99 others); Thu, 6 May 2021 11:37:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:46408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235698AbhEFPdx (ORCPT ); Thu, 6 May 2021 11:33:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 50EAF61481; Thu, 6 May 2021 15:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620315174; bh=jDjvYmJ9QZ5eFWkjBBpJHdBeKaOXh+IEdL5qMvJJIWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ngm8BGD8/2QMRyvGZYPTTe0KnFEj+I3VakCN5h9NX97TEr9LV0LzIZ9JGjnjfcu7D YnCNEXpvnld6/Y8lHpvxt5sJSIp7ZZouxyrTLCWDmJRvE2K+TrFYxjfOxkwlLXGGO/ dVMsAokKeBAPHN6KL3ELgw4VnlIm3HyvVZsiE42u+605QrAwmwUSFh890Q9o9ACjX6 BgWbgX30Ynmn6rRDqUVRO/L6gHiWg8fYQ2OL0ESL/9ynHM1fDRcZntS+2fNpRralw9 SJy8reiyQWnBrwExdV7Ep596diKG/UDm7ujNk/hCGbqYqS1+IO5DvGFWuDJ6PFuVeQ SKCCuMDj1hugw== Received: by pali.im (Postfix) id 081C2732; Thu, 6 May 2021 17:32:54 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas Cc: Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , Marc Zyngier , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 33/42] PCI: pci-bridge-emul: Add definitions for missing capabilities registers Date: Thu, 6 May 2021 17:31:44 +0200 Message-Id: <20210506153153.30454-34-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210506153153.30454-1-pali@kernel.org> References: <20210506153153.30454-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci-bridge-emul driver already allocates buffer for capabilities up to the PCI_EXP_SLTSTA2 register, but does not define bit access behavior for these registers. Fix it by adding missing definitions. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Fixes: 23a5fba4d941 ("PCI: Introduce PCI bridge emulated config space common logic") --- drivers/pci/pci-bridge-emul.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c index 2b6ea84f25af..5f8398f8d039 100644 --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -251,6 +251,44 @@ struct pci_bridge_reg_behavior pcie_cap_regs_behavior[PCI_CAP_PCIE_SIZEOF / 4] = .ro = GENMASK(15, 0) | PCI_EXP_RTSTA_PENDING, .w1c = PCI_EXP_RTSTA_PME, }, + + [PCI_EXP_DEVCAP2 / 4] = { + /* Device capabilities 2 register has reserved bits [30:24] and [17:16]. */ + .ro = BIT(31) | GENMASK(23, 18) | GENMASK(15, 0), + }, + + [PCI_EXP_DEVCTL2 / 4] = { + /* + * Device control 2 register is RW but has reserved bits [12:11]. + * + * Device status 2 register is reserved. + */ + .rw = GENMASK(15, 13) | GENMASK(10, 0), + }, + + [PCI_EXP_LNKCAP2 / 4] = { + /* Link capabilities 2 register has reserved bits [30:23] and 0. */ + .ro = BIT(31) | GENMASK(22, 1), + }, + + [PCI_EXP_LNKCTL2 / 4] = { + /* + * Link control 2 register is RW. + * + * Link status 2 register has bits 5, 10, 15 W1C; bit 11 reserved and others are RO. + */ + .rw = GENMASK(15, 0), + .w1c = (BIT(15) | BIT(10) | BIT(5)) << 16, + .ro = (GENMASK(14, 12) | GENMASK(9, 6) | GENMASK(4, 0)) << 16, + }, + + [PCI_EXP_SLTCAP2 / 4] = { + /* Slot capabilities 2 register is reserved. */ + }, + + [PCI_EXP_SLTCTL2 / 4] = { + /* Both Slot control 2 and Slot status 2 registers are reserved. */ + }, }; /* -- 2.20.1