From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 32BA13368B6 for ; Mon, 6 Jul 2026 19:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783366598; cv=none; b=oyF8NPtQQN+mhsJWrpIRAD5IyuIXRQ7Zwl880AITcPEtfFDJXFDZJ2jC/7iYt1nx9GM46otKFG4Eu/xY5KZq6kERGtDbsCSI8A7VHSkUkN7sUvb5jcOCoIGIUjeihrtI/NZ+1cT2sZTc8EsySx4VacoII9ye6559xZw9XWjJnJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783366598; c=relaxed/simple; bh=qkYYx/CCb+IWiPwjSa3tz1/tM0E1KBPOEc0cPKx/5wU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VUQ4vdAkhfM14xs9GWL7MqTyHk9ooRs1zYMSiccc8N4nWvT920G2Ghs09efY6EUe7VOaIpqV0swPw4Nbob0P7W0EJL6wldBZdS8npnrOOjErehjX+Ha81VLQbrCcB1LCa4baMxZJlA+dnxP9tZPEHkCs2phDQzhIbNFmwxy/Nfc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=L+kETeka; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="L+kETeka" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 666FInsG508759; Mon, 6 Jul 2026 19:36:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=xyVghz0BdLLck4MWc Y4YY/JnDc/q9kOQqZCD96Q900o=; b=L+kETekaH28bp306UB3BlWRDsBbADgoH9 oXGs7BNbskymhLX0A/gYAlq7qbvmyu46D5uIgrYxR1BnkFB0E+PDZJx0QImscwFW kBgX2pXT9i7v0Xgp3fkxfo5fH6VSgEc6e2+72+dWx5rGrwdTXF9xnMI3S1zlpZpK mxx4AKbSFVXaB7lfD2xkOvJPWmR9cHc4okDgKtJgDcjHBhhLx+c/bCtsIQ14a30W SitYbdZTUPf4jbJJJSiUtsPYNvBFRWH4lg5bZVKq2iUs/zng+zO8UPEgn2Ebctyo VtkP8M25bQHpZSBGFnA3TOY+FtQA9EeQPb6znejkVexdwKhj+2dzA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f6sw4k3e7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jul 2026 19:36:22 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 666JYZfn018719; Mon, 6 Jul 2026 19:36:21 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f7e0h6v05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jul 2026 19:36:21 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 666JaKPn16974378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Jul 2026 19:36:20 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A97D5805A; Mon, 6 Jul 2026 19:36:20 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 608AE58051; Mon, 6 Jul 2026 19:36:19 +0000 (GMT) Received: from localhost.localdomain (unknown [9.61.26.177]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Jul 2026 19:36:19 +0000 (GMT) From: Mingming Cao To: netdev@vger.kernel.org Cc: horms@kernel.org, bjking1@linux.ibm.com, haren@linux.ibm.com, ricklind@linux.ibm.com, mmc@linux.ibm.com, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com, mpe@ellerman.id.au, Dave Marquardt Subject: [PATCH net-next v3 01/15] ibmveth: Add MQ RX hypercall wrappers and call definitions Date: Mon, 6 Jul 2026 12:35:49 -0700 Message-Id: <20260706193603.8039-2-mmc@linux.ibm.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260706193603.8039-1-mmc@linux.ibm.com> References: <20260706193603.8039-1-mmc@linux.ibm.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: 1ElmNMxKrSgI25uaFbGtnkclSjWOVXMn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA2MDE5NSBTYWx0ZWRfX2Dc5wWFWku6O nA7faGwQFmYPpYA27ZoFjoreUu9azr7S4FjRoXR7QzEayi43vjAXePrhyWOdvbiYsXyIAGrjx8S DPwLDkYE2djsZ1dRIHw2HUclCftYI0eMQOxqkvfysMJ67y9awQDLYCwao209GDzMCgb0Yl/DpMD s67bIJGPN1yyKKUTOVtgkgJ3QUQLOY2BHUV1LVoGpKlwS5IlZCLwGzx470i5zWhe5JV7LOObIaH zr1xvpMICm33trIOpoYPbwCPNJ3dHdR8OFUdoxonTVWoo1UWlGuG3v8Q3W4adsJEvgddgfbsh/7 mPIIlhO8xr2EJinboWwPcRUKwzWZgwWK0I/HrNmRANUWqN+qSvPtbEi/c0qtrKGbKsl3zs0H53c fU2emDPnIHKm+ScSRXkIcoT558dnjQDaeIfNMvFXceejPeVDG9u8E+G/DNYOL6NAGhu2BsBkZcX wpE+3EaqCCtlFTLFUVg== X-Proofpoint-ORIG-GUID: _MuY1qVK-_mB4IYzEwMfkJa3R0Gto9G_ X-Authority-Analysis: v=2.4 cv=FqQ1OWrq c=1 sm=1 tr=0 ts=6a4c03b7 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=MvuV-DllYkNUqFi9bgAA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA2MDE5NSBTYWx0ZWRfXzmAfylsgpRy+ qSuWNWgbvfzwaAqNGIXFbPRQb80O9Di2S3jrbYLUkdbDnDskLGd8LZhh3sDmU/LPEb+gKgTNe0j 2dA+d6qcGtS+OXGg/JNwEmLHafa7CJ0= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-06_02,2026-07-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607060195 Single-queue ibmveth only needs h_register_logical_lan() plus legacy buffer add/free calls. MQ RX uses per-queue handles, so the driver must also be able to register/deregister subordinate queues and post/free buffers against a specific queue handle. Add the PHYP call IDs for: H_REG_LOGICAL_LAN_QUEUE H_ADD_LOGICAL_LAN_BUFFERS_QUEUE H_FREE_LOGICAL_LAN_BUFFER_QUEUE H_FREE_LOGICAL_LAN_QUEUE and add ibmveth.h wrapper helpers (h_reg_logical_lan_queue(), h_add_logical_lan_buffers_queue(), h_free_logical_lan_buffer_queue(), h_free_logical_lan_queue()) with argument ordering and return semantics matching the existing ibmveth hcall wrappers. This patch is intentionally plumbing only: no runtime behavior change yet. Legacy firmware keeps H_REGISTER_LOGICAL_LAN and the existing buffer hcalls. The new wrappers are used only when a later commit sets multi_queue from H_ILLAN_ATTRIBUTES. Signed-off-by: Mingming Cao Reviewed-by: Dave Marquardt --- arch/powerpc/include/asm/hvcall.h | 6 +- drivers/net/ethernet/ibm/ibmveth.c | 3 +- drivers/net/ethernet/ibm/ibmveth.h | 158 +++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index dff90a7d7f70..bf2f1b0356c4 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -362,7 +362,11 @@ #define H_GUEST_DELETE 0x488 #define H_PKS_WRAP_OBJECT 0x490 #define H_PKS_UNWRAP_OBJECT 0x494 -#define MAX_HCALL_OPCODE H_PKS_UNWRAP_OBJECT +#define H_REG_LOGICAL_LAN_QUEUE 0x49C +#define H_ADD_LOGICAL_LAN_BUFFERS_QUEUE 0x4A0 +#define H_FREE_LOGICAL_LAN_BUFFER_QUEUE 0x4A4 +#define H_FREE_LOGICAL_LAN_QUEUE 0x4A8 +#define MAX_HCALL_OPCODE H_FREE_LOGICAL_LAN_QUEUE /* Scope args for H_SCM_UNBIND_ALL */ #define H_UNBIND_SCOPE_ALL (0x1) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 73e051d26b9d..af287eeafc0c 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -584,7 +584,8 @@ static int ibmveth_allocate_tx_ltb(struct ibmveth_adapter *adapter, int idx) } static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, - union ibmveth_buf_desc rxq_desc, u64 mac_address) + union ibmveth_buf_desc rxq_desc, + u64 mac_address) { int rc, try_again = 1; diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h index d87713668ed3..45cfb0d054e3 100644 --- a/drivers/net/ethernet/ibm/ibmveth.h +++ b/drivers/net/ethernet/ibm/ibmveth.h @@ -66,6 +66,164 @@ static inline long h_add_logical_lan_buffers(unsigned long unit_address, desc5, desc6, desc7, desc8); } +/** + * h_reg_logical_lan_queue - Register a subordinate receive queue + * @unit_address: Device unit address + * @buffer_list: DMA address of 4KB page for tracking registered buffers + * @rec_queue: Buffer descriptor of receive queue + * + * Registers a subordinate receive queue with the hypervisor. + * + * Return: + * H_SUCCESS (0) on success + * H_PARAMETER if parameters are invalid + * + * On success, hypervisor returns: + * R3: H_SUCCESS + * R4: Queue handle + * R5: IRQ number for this queue + */ +static inline long h_reg_logical_lan_queue(unsigned long unit_address, + unsigned long buffer_list, + unsigned long rec_queue, + unsigned long *queue_handle, + unsigned long *irq) +{ + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; + long rc; + + rc = plpar_hcall9(H_REG_LOGICAL_LAN_QUEUE, + retbuf, unit_address, + buffer_list, rec_queue); + + if (rc == H_SUCCESS) { + if (queue_handle) + *queue_handle = retbuf[0]; + if (irq) + *irq = retbuf[1]; + } + + return rc; +} + +/** + * h_add_logical_lan_buffers_queue - Add buffers to subordinate queue + * @unit_address: Device unit address + * @queue_handle: Queue handle from h_reg_logical_lan_queue() + * @buffersznum: Buffer size (upper 32 bits) | count (lower 32 bits) + * @ioba12: Buffer addresses 1 and 2 packed (addr1 | addr2 << 32) + * @ioba34: Buffer addresses 3 and 4 packed + * @ioba56: Buffer addresses 5 and 6 packed + * @ioba78: Buffer addresses 7 and 8 packed + * @ioba910: Buffer addresses 9 and 10 packed + * @ioba1112: Buffer addresses 11 and 12 packed + * + * Return: + * H_SUCCESS - All buffers added successfully + * H_PARAMETER - Invalid parameters + * H_HARDWARE - Hardware error + */ +static inline long h_add_logical_lan_buffers_queue(unsigned long unit_address, + unsigned long queue_handle, + unsigned long buffersznum, + unsigned long ioba12, + unsigned long ioba34, + unsigned long ioba56, + unsigned long ioba78, + unsigned long ioba910, + unsigned long ioba1112) +{ + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; + + return plpar_hcall9(H_ADD_LOGICAL_LAN_BUFFERS_QUEUE, + retbuf, unit_address, + queue_handle, buffersznum, + ioba12, ioba34, ioba56, + ioba78, ioba910, ioba1112); +} + +/** + * h_free_logical_lan_buffer_queue - Free buffer from subordinate queue + * @unit_address: Device unit address + * @buf_size: Size of buffer to remove from pool + * @queue_handle: Queue handle from h_reg_logical_lan_queue() + * + * Removes a buffer of specified size from the subordinate queue's buffer pool. + * + * Return: + * H_SUCCESS - Buffer removed successfully + * H_PARAMETER - Invalid parameters + * H_HARDWARE - Hardware error + * H_NOT_FOUND - Buffer pool does not exist + */ +static inline long h_free_logical_lan_buffer_queue(unsigned long unit_address, + unsigned long buf_size, + unsigned long queue_handle) +{ + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; + + return plpar_hcall9(H_FREE_LOGICAL_LAN_BUFFER_QUEUE, + retbuf, unit_address, buf_size, queue_handle); +} + +/** + * h_free_logical_lan_queue - Deregister subordinate receive queue + * @unit_address: Device unit address + * @queue_handle: Queue handle from h_reg_logical_lan_queue() + * + * Deregisters and frees all structures associated with the subordinate queue. + * + * Return: + * H_SUCCESS - Queue freed successfully + * H_PARAMETER - Invalid parameters + * H_HARDWARE - Hardware error + * H_STATE - VIOA not in valid state + * H_BUSY / H_LONG_BUSY_* - Resource busy, retry + */ +static inline long h_free_logical_lan_queue(unsigned long unit_address, + unsigned long queue_handle) +{ + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; + + return plpar_hcall9(H_FREE_LOGICAL_LAN_QUEUE, + retbuf, unit_address, queue_handle); +} + +/** + * h_register_logical_lan_with_handle - Register primary queue and get handle + * @unit_address: Device unit address + * @buffer_list: DMA address of buffer list + * @rec_queue: Buffer descriptor of receive queue + * @filter_list: DMA address of filter list + * @mac_address: MAC address + * @queue_handle: Output parameter for queue handle + * + * Registers the primary receive queue (queue 0) with the hypervisor and + * returns the queue handle. This is needed in multi-queue mode to use + * h_add_logical_lan_buffers_queue() for all queues including queue 0. + * + * Return: H_SUCCESS (0) on success, error code otherwise + */ +static inline long h_register_logical_lan_with_handle(unsigned long unit_address, + unsigned long buffer_list, + unsigned long rec_queue, + unsigned long filter_list, + unsigned long mac_address, + u64 *queue_handle) +{ + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; + long rc; + + rc = plpar_hcall9(H_REGISTER_LOGICAL_LAN, retbuf, + unit_address, buffer_list, rec_queue, + filter_list, mac_address); + + if (rc == H_SUCCESS && queue_handle) + *queue_handle = retbuf[0]; + + return rc; +} + /* FW allows us to send 6 descriptors but we only use one so mark * the other 5 as unused (0) */ -- 2.39.3 (Apple Git-146)