Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp7732ybt; Fri, 12 Jun 2020 17:46:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhdZ6/GrWCg6NAJgVX60otXvMwwek/X+hGV2OompRTGK3Tvl4h+ly5pmf1z/87xtSAajnb X-Received: by 2002:a05:6402:312a:: with SMTP id dd10mr14630081edb.320.1592009187191; Fri, 12 Jun 2020 17:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592009187; cv=none; d=google.com; s=arc-20160816; b=xt3FiAr/NYt04pqp9hRPcPMrXjmOo4f5UHkM8hhG5DOeDmGxNwwqWQtQHTSWIj9Z5u jSzr9lsuLCH2MUIfvzzfbEs/hGAgdooF+qlFAIN1e/WILmedV04643i81IQ8uaqBscEL o/RiT/GJPom95J+137YTPDaxrMwRnByzfGiJcczw5BNLNZl8UYB8G9W4zbcaCIYVxQ0o dzBOsKjifzDSq5NeOqQuFhS/qbomGT3unkAtQtmj63qky3Tvfscmohnvlz+eOKFmtHi+ PoucS3NSOss70ptPFX6WxiiDtZ9Hy8uMyn6Q0OZ+VFTWg3PXjwMtGpAri+dUjjp3q+0e LFyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=CuzCj9iuHYcNfsgXOnrNnohAZDLg+9tL26Wcq9ziopw=; b=yXZ9xvP7AFs+SLJwl69VFL2RHJoYEuCkX8S2go6sRCT60QHnAgwbecHZ/tc1akAxLl GEPND6fN2Bw8U/wcjmuz2rgu6J5ACTbD3haHG3cx2m5CfhIcxfiWzokg1h6dNcmuEoRR OlzNF81XJ0RpvJdRpsU0Zw45yEPXIImsHnGy8D6Iprzn7m4MJFxxF4vMq4ByCP1u4THf c7nmLFXbhfHxzKrvl3HGDCJzozQX75Y0lHe0g5TgVAyGqRz1Gg+51O4HMA4Ad9zLi4FQ RvfqIUvoa+k+iTieIkndyaMCCZqmBN0aPNI+qUrSaUdY6n2pPTyAr85k3/wa1SwEJvK0 Zz+A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si4740779ejc.318.2020.06.12.17.46.04; Fri, 12 Jun 2020 17:46:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgFMAl4 (ORCPT + 99 others); Fri, 12 Jun 2020 20:41:56 -0400 Received: from mga12.intel.com ([192.55.52.136]:1253 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbgFMAlu (ORCPT ); Fri, 12 Jun 2020 20:41:50 -0400 IronPort-SDR: 55e75vw7WKXAa9q8m8J0nO8WOAHfjg1MCNwb0cdMOEtnvQdr5iZ0uUvudg0MxwS/ZEfoX/VsBz MYBzdlN1/VTw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 17:41:49 -0700 IronPort-SDR: Sct9MjJC62mRYFUbJa/qZ+08V7OOdKBTlLA32kVvSAo6p/AOf5KCWiPiWgBSzWV4xUaMrkGcyA XUDfwA+UFgaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,505,1583222400"; d="scan'208";a="261011191" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga007.jf.intel.com with ESMTP; 12 Jun 2020 17:41:49 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "David Woodhouse" , "Lu Baolu" , "Frederic Barrat" , "Andrew Donnellan" , "Felix Kuehling" , "Joerg Roedel" , "Dave Hansen" , "Tony Luck" , "Ashok Raj" , "Jacob Jun Pan" , "Dave Jiang" , "Yu-cheng Yu" , "Sohil Mehta" , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , iommu@lists.linux-foundation.org, "amd-gfx" , "linuxppc-dev" , Fenghua Yu Subject: [PATCH v2 02/12] ocxl: Change type of pasid to unsigned int Date: Fri, 12 Jun 2020 17:41:23 -0700 Message-Id: <1592008893-9388-3-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1592008893-9388-1-git-send-email-fenghua.yu@intel.com> References: <1592008893-9388-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PASID is defined as "int" although it's a 20-bit value and shouldn't be negative int. To be consistent with type defined in iommu, define PASID as "unsigned int". Suggested-by: Thomas Gleixner Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v2: - Create this new patch to define PASID as "unsigned int" consistently in ocxl (Thomas) drivers/misc/ocxl/config.c | 3 ++- drivers/misc/ocxl/link.c | 6 +++--- drivers/misc/ocxl/ocxl_internal.h | 6 +++--- drivers/misc/ocxl/pasid.c | 2 +- drivers/misc/ocxl/trace.h | 20 ++++++++++---------- include/misc/ocxl.h | 6 +++--- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index c8e19bfb5ef9..22d034caed3d 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -806,7 +806,8 @@ int ocxl_config_set_TL(struct pci_dev *dev, int tl_dvsec) } EXPORT_SYMBOL_GPL(ocxl_config_set_TL); -int ocxl_config_terminate_pasid(struct pci_dev *dev, int afu_control, int pasid) +int ocxl_config_terminate_pasid(struct pci_dev *dev, int afu_control, + unsigned int pasid) { u32 val; unsigned long timeout; diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c index 58d111afd9f6..931f6ae022db 100644 --- a/drivers/misc/ocxl/link.c +++ b/drivers/misc/ocxl/link.c @@ -492,7 +492,7 @@ static u64 calculate_cfg_state(bool kernel) return state; } -int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, +int ocxl_link_add_pe(void *link_handle, unsigned int pasid, u32 pidr, u32 tidr, u64 amr, struct mm_struct *mm, void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), void *xsl_err_data) @@ -572,7 +572,7 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, } EXPORT_SYMBOL_GPL(ocxl_link_add_pe); -int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid) +int ocxl_link_update_pe(void *link_handle, unsigned int pasid, __u16 tid) { struct ocxl_link *link = (struct ocxl_link *) link_handle; struct spa *spa = link->spa; @@ -608,7 +608,7 @@ int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid) return rc; } -int ocxl_link_remove_pe(void *link_handle, int pasid) +int ocxl_link_remove_pe(void *link_handle, unsigned int pasid) { struct ocxl_link *link = (struct ocxl_link *) link_handle; struct spa *spa = link->spa; diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index 345bf843a38e..3ca982ba7472 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -41,7 +41,7 @@ struct ocxl_afu { struct ocxl_afu_config config; int pasid_base; int pasid_count; /* opened contexts */ - int pasid_max; /* maximum number of contexts */ + unsigned int pasid_max; /* maximum number of contexts */ int actag_base; int actag_enabled; struct mutex contexts_lock; @@ -69,7 +69,7 @@ struct ocxl_xsl_error { struct ocxl_context { struct ocxl_afu *afu; - int pasid; + unsigned int pasid; struct mutex status_mutex; enum ocxl_context_status status; struct address_space *mapping; @@ -128,7 +128,7 @@ int ocxl_config_check_afu_index(struct pci_dev *dev, * pasid: the PASID for the AFU context * tid: the new thread id for the process element */ -int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); +int ocxl_link_update_pe(void *link_handle, unsigned int pasid, __u16 tid); int ocxl_context_mmap(struct ocxl_context *ctx, struct vm_area_struct *vma); diff --git a/drivers/misc/ocxl/pasid.c b/drivers/misc/ocxl/pasid.c index d14cb56e6920..a151fc8f0bec 100644 --- a/drivers/misc/ocxl/pasid.c +++ b/drivers/misc/ocxl/pasid.c @@ -80,7 +80,7 @@ static void range_free(struct list_head *head, u32 start, u32 size, int ocxl_pasid_afu_alloc(struct ocxl_fn *fn, u32 size) { - int max_pasid; + unsigned int max_pasid; if (fn->config.max_pasid_log < 0) return -ENOSPC; diff --git a/drivers/misc/ocxl/trace.h b/drivers/misc/ocxl/trace.h index 17e21cb2addd..019e2fc63b1d 100644 --- a/drivers/misc/ocxl/trace.h +++ b/drivers/misc/ocxl/trace.h @@ -9,13 +9,13 @@ #include DECLARE_EVENT_CLASS(ocxl_context, - TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr), + TP_PROTO(pid_t pid, void *spa, unsigned int pasid, u32 pidr, u32 tidr), TP_ARGS(pid, spa, pasid, pidr, tidr), TP_STRUCT__entry( __field(pid_t, pid) __field(void*, spa) - __field(int, pasid) + __field(unsigned int, pasid) __field(u32, pidr) __field(u32, tidr) ), @@ -38,21 +38,21 @@ DECLARE_EVENT_CLASS(ocxl_context, ); DEFINE_EVENT(ocxl_context, ocxl_context_add, - TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr), + TP_PROTO(pid_t pid, void *spa, unsigned int pasid, u32 pidr, u32 tidr), TP_ARGS(pid, spa, pasid, pidr, tidr) ); DEFINE_EVENT(ocxl_context, ocxl_context_remove, - TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr), + TP_PROTO(pid_t pid, void *spa, unsigned int pasid, u32 pidr, u32 tidr), TP_ARGS(pid, spa, pasid, pidr, tidr) ); TRACE_EVENT(ocxl_terminate_pasid, - TP_PROTO(int pasid, int rc), + TP_PROTO(unsigned int pasid, int rc), TP_ARGS(pasid, rc), TP_STRUCT__entry( - __field(int, pasid) + __field(unsigned int, pasid) __field(int, rc) ), @@ -107,11 +107,11 @@ DEFINE_EVENT(ocxl_fault_handler, ocxl_fault_ack, ); TRACE_EVENT(ocxl_afu_irq_alloc, - TP_PROTO(int pasid, int irq_id, unsigned int virq, int hw_irq), + TP_PROTO(unsigned int pasid, int irq_id, unsigned int virq, int hw_irq), TP_ARGS(pasid, irq_id, virq, hw_irq), TP_STRUCT__entry( - __field(int, pasid) + __field(unsigned int, pasid) __field(int, irq_id) __field(unsigned int, virq) __field(int, hw_irq) @@ -133,11 +133,11 @@ TRACE_EVENT(ocxl_afu_irq_alloc, ); TRACE_EVENT(ocxl_afu_irq_free, - TP_PROTO(int pasid, int irq_id), + TP_PROTO(unsigned int pasid, int irq_id), TP_ARGS(pasid, irq_id), TP_STRUCT__entry( - __field(int, pasid) + __field(unsigned int, pasid) __field(int, irq_id) ), diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 06dd5839e438..5eca04c8da97 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h @@ -429,7 +429,7 @@ int ocxl_config_set_TL(struct pci_dev *dev, int tl_dvsec); * desired AFU. It can be found in the AFU configuration */ int ocxl_config_terminate_pasid(struct pci_dev *dev, - int afu_control_offset, int pasid); + int afu_control_offset, unsigned int pasid); /* * Read the configuration space of a function and fill in a @@ -466,7 +466,7 @@ void ocxl_link_release(struct pci_dev *dev, void *link_handle); * 'xsl_err_data' is an argument passed to the above callback, if * defined */ -int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, +int ocxl_link_add_pe(void *link_handle, unsigned int pasid, u32 pidr, u32 tidr, u64 amr, struct mm_struct *mm, void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), void *xsl_err_data); @@ -474,7 +474,7 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, /* * Remove a Process Element from the Shared Process Area for a link */ -int ocxl_link_remove_pe(void *link_handle, int pasid); +int ocxl_link_remove_pe(void *link_handle, unsigned int pasid); /* * Allocate an AFU interrupt associated to the link. -- 2.19.1