From patchwork Mon Jul 29 09:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13744667 X-Patchwork-Delegate: bhelgaas@google.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C63313DB99 for ; Mon, 29 Jul 2024 09:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722245827; cv=none; b=asqRLb72OZ3XxqxZAfoyTstw8cBqiyXpYEY6aGvDwMc5zFT1YVz8FmQ4mlPWlbgJZ5ZEBuwWU21gWSPES2Qp/WtmsDpDg2WL36Vk++ognaAXgPyUCQwaTtBqY3jcqE3Y3fpC7N0rsONkF5NMxRDphV0Htc6tMaVmcHz8qJpv9D8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722245827; c=relaxed/simple; bh=sOPFbdAZcLvZ5+tla0cjE7R9UahwXgYuHDOyDiiXoq0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rMb4xdki8ld+iL4UgVwqv8AHSAh8ACh84wrvMCriNASP7J0BhvI5200S4AbqARFnyTet4RMaCb7q3ENsQq/BSexEozv6Sf8NeUndDSKeUXiWJp7nXaOj9Unr8SRMhTElu4YGk+1sUW7/e8x+3Od8sd5jPk+I+8xkwy7W7FOjmto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Dkw8oh2h; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Dkw8oh2h" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722245824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42kYX+we7aWmN9i2s2pGfyq6/m9TDK9MaaqQ5jcnuoY=; b=Dkw8oh2h8V8BabQ0xUrXugLbFJHV70nxP9Bjy6ml2ajYcX4WSzO4AoWBfjvs/2qrupWvoS BqkgdH9xTmssJlCJEJVLAf9fTXUGrrpCs4MTl58DmUHRDL1TtCpksj9qyYNcnyKxhw/ha3 dQh8QaoT3dTBZJ74jDhbeM3X4GpYGPo= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-HtKo6Wr4NCeSpbTX1iperA-1; Mon, 29 Jul 2024 05:37:02 -0400 X-MC-Unique: HtKo6Wr4NCeSpbTX1iperA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6b7678caf7dso8362206d6.1 for ; Mon, 29 Jul 2024 02:37:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722245822; x=1722850622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=42kYX+we7aWmN9i2s2pGfyq6/m9TDK9MaaqQ5jcnuoY=; b=rRf6Rz6kQcFwJQubJWXNIfMdDHIQxxLhT8LI+ScafX9RsyMQDuf7B0Gs33mJ95SBll Of5RPvuhWt2MyIX93B6AbBoCK6iArcI4HW4CBK0/TY9VRbplufyWgi2bIDEDAXZDq/oS hw4hGLsGkaVGvDF+GwEBz+UXKZ6m753CbBOPXjVfB1JYzpPi7L2oT+oExQvQfJFAJI3w Ox5XWDILeaOP5uPd6Y1UYvaXbcbqOiJa0o3H4IrgIHEzcanMYdagu3GlHTwzOv+UvYtq Tj0SmSUyWHx7gQ9bTCKDC3FJ0v1uUaKJWRR3YihmFbx6/wwG0tCmbz5pz0jBxMIQze9F xrWQ== X-Forwarded-Encrypted: i=1; AJvYcCWy1cZLpHJPKXh4Eua+8Wh04cVxukWv2cwMFsuVvn492/qvrJPZ+IjmOXSjrDjr7f9LDFHWA6euGauDM9rpO5TcjZP8BHf+SxJK X-Gm-Message-State: AOJu0YxhmM4bkM5GSnjKhpu3OcSVoVLGFAa6YZSK1iMuSJvVpAv6kzaj KfGPkZ32fmK6rvqvpDZwHMNfQfCPv4OWEXN7kW11VzgMSUFfj45CZJuZV7kjMeCzI6uSyN2XXST EzCNlBCYmnD+LYPN7+HWC5SyjiKb0AOSaIgY9McqCSuUbt208a9G1gYKHVw== X-Received: by 2002:ad4:5f87:0:b0:6b7:586c:6db with SMTP id 6a1803df08f44-6bb3e38b497mr93633316d6.9.1722245822099; Mon, 29 Jul 2024 02:37:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgkPP99cFbQc6WSD5piny1t+VTMR84B7lZvZiZJT2aKKHRfx8A/j8DuWgpWI66gNwcsld6zA== X-Received: by 2002:ad4:5f87:0:b0:6b7:586c:6db with SMTP id 6a1803df08f44-6bb3e38b497mr93633256d6.9.1722245821694; Mon, 29 Jul 2024 02:37:01 -0700 (PDT) Received: from dhcp-64-164.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3fa94a16sm50047086d6.86.2024.07.29.02.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 02:37:01 -0700 (PDT) From: Philipp Stanner To: Hans de Goede , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Bjorn Helgaas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Philipp Stanner Subject: [PATCH 1/2] PCI: Make pcim_request_region() a public function Date: Mon, 29 Jul 2024 11:36:26 +0200 Message-ID: <20240729093625.17561-4-pstanner@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240729093625.17561-2-pstanner@redhat.com> References: <20240729093625.17561-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pcim_request_region() is the managed counterpart of pci_request_region(). It is currently only used internally for PCI. It can be useful for a number of drivers and exporting it is a step towards deprecating more complicated functions. Make pcim_request_region a public function. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 3780a9f9ec00..0127ca58c6e5 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -863,6 +863,7 @@ int pcim_request_region(struct pci_dev *pdev, int bar, const char *name) { return _pcim_request_region(pdev, bar, name, 0); } +EXPORT_SYMBOL(pcim_request_region); /** * pcim_request_region_exclusive - Request a PCI BAR exclusively diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 79c8398f3938..2fe6055a334d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -887,8 +887,6 @@ static inline pci_power_t mid_pci_get_power_state(struct pci_dev *pdev) #endif int pcim_intx(struct pci_dev *dev, int enable); - -int pcim_request_region(struct pci_dev *pdev, int bar, const char *name); int pcim_request_region_exclusive(struct pci_dev *pdev, int bar, const char *name); void pcim_release_region(struct pci_dev *pdev, int bar); diff --git a/include/linux/pci.h b/include/linux/pci.h index 9e36b6c1810e..e5d8406874e2 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2294,6 +2294,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass, void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); +int pcim_request_region(struct pci_dev *pdev, int bar, const char *name); int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, const char *name); From patchwork Mon Jul 29 09:36:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13744668 X-Patchwork-Delegate: bhelgaas@google.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1BFA770E1 for ; Mon, 29 Jul 2024 09:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722245829; cv=none; b=MY7PYxC4Kd8lOO3iQPhI3LPwVKuoQXNqVee2f4fKi1SRqr/aTuGB27fIpEahsUWMYVG/C7mYfiAC7bJPgM5hAmkggcDFTa/RDUl9UGI0Be++c4Xo3Ooo7zDA9nyuvJY5q8FPQmkpohtDGJeUd9rxc4HoplJfmR1+U+v1Eh2s7Po= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722245829; c=relaxed/simple; bh=q+R0BpDAfe+tAd0rPJpsXFT4k1DLRypi7UxROY3RFFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rf/H9f4lci0IVNpgIztY8gkq/0ZotQh1J4X13yLDSPASwuxqGUGw1U11D8j4gTsQHnO7mL8h2GImeD2JphS9+2A54ntyao2jUO276BVqj7tZCfdy1ZTE0a53U/GSwT0XYMRL6q5BzEKjyVLgLYxgrlP6TCzNgnXJHWNhfeayKmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AXL0jiEA; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AXL0jiEA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722245826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8yzHolj0LBWvvfbf6+tRyOWfIn+0w0Jej2YhRYKH2Gc=; b=AXL0jiEACOHMyFDkK9gWKCB/VCH09jVUUE/w6zKOPD8sZraRKzEvhR+nvoVFH2JukmWS/G AVk5ByJeb099fKXeAI1Cp6H34ulsAvI6mM5zW6S5itDlvvcE/YUC0JtforYi7caGuqu0m1 WQEDpbZZkGwvAgSuHr9yB5qnL4iFVg8= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-2nohE3dAMkWcvvT9bZwpcA-1; Mon, 29 Jul 2024 05:37:04 -0400 X-MC-Unique: 2nohE3dAMkWcvvT9bZwpcA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6b7a47a271cso7339396d6.2 for ; Mon, 29 Jul 2024 02:37:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722245824; x=1722850624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8yzHolj0LBWvvfbf6+tRyOWfIn+0w0Jej2YhRYKH2Gc=; b=ijTOHKCktpG/x5fzWWsNoSczFlkTnq4m+z/229SQi2u7qRdWfsJnDW75QYkz3hgIFy yD3sb7KauKpQ4EpvcSp41/Eo2uk5Vok4v4mYBMHL/GhdosBWKUwET+v+TmZ/TaQ6EMP7 L0M+0keioqdwPHQjuMTUt4QD1CJ+P4UFpHFoYybqWXcj5/MBb9pv0mynZWuTVjdM3bhX CEkHPW3M5Vx0OnLuIZsC5Ex+d+MiRzrw/NwYafVBUfj5puG7SuKHn8+uuuTRm9zklpg2 X7sy2KV35SMC6Ej2ooAgDUdtQHIES6MmZjy9JzIkFEB1q2S66UDNFPQmjWEYhYlFvgoN 4XEA== X-Forwarded-Encrypted: i=1; AJvYcCVKVf49nf+fTUXUqZkXyllyCez135HxCJ7eTSTnoGNjI4SfSdiNUwMfChXslJtkMg9FAmefp5VZnf1MulE7l3abP9PMhZORVxXt X-Gm-Message-State: AOJu0YyHnag72prkz8GZEhmJ5fCUZFOgrxGODKNx6ifGzDidvXjGFna5 IR/49mNsMoAenqJcCtcU3ccFYLxF31KYqc56KxWRR69huBfVF1nf6vFN2KymurC2LZlyGIQ6+gn RGHlAbBev6HlbRQlpbcOPpxrVv5L6k+tCohsPrfMQ3fGJsYArVHqEQKcQJg== X-Received: by 2002:a05:6214:2b0a:b0:6b7:7832:2211 with SMTP id 6a1803df08f44-6bb3e2043dbmr102004156d6.3.1722245824090; Mon, 29 Jul 2024 02:37:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFajgcbMizSfez+xFTta1vgiY+ZYkosQdlpq9GU2h/rROwHquJE6I29rQYeZi0foyo1YN47NA== X-Received: by 2002:a05:6214:2b0a:b0:6b7:7832:2211 with SMTP id 6a1803df08f44-6bb3e2043dbmr102003986d6.3.1722245823659; Mon, 29 Jul 2024 02:37:03 -0700 (PDT) Received: from dhcp-64-164.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3fa94a16sm50047086d6.86.2024.07.29.02.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 02:37:03 -0700 (PDT) From: Philipp Stanner To: Hans de Goede , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Bjorn Helgaas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Philipp Stanner Subject: [PATCH 2/2] drm/vboxvideo: Add PCI region request Date: Mon, 29 Jul 2024 11:36:27 +0200 Message-ID: <20240729093625.17561-5-pstanner@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240729093625.17561-2-pstanner@redhat.com> References: <20240729093625.17561-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 vboxvideo currently does not reserve its PCI BAR through a region request. Implement the request through the managed function pcim_request_region(). Signed-off-by: Philipp Stanner --- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c index d4ade9325401..7f686a0190e6 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -114,6 +114,10 @@ int vbox_hw_init(struct vbox_private *vbox) DRM_INFO("VRAM %08x\n", vbox->full_vram_size); + ret = pcim_request_region(pdev, 0, "vboxvideo"); + if (ret) + return ret; + /* Map guest-heap at end of vram */ vbox->guest_heap = pcim_iomap_range(pdev, 0, GUEST_HEAP_OFFSET(vbox), GUEST_HEAP_SIZE);