Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp417981lqp; Wed, 12 Jun 2024 05:54:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb1uyrr9xR31Vnp+NEx2ByaqxIn7h0mhYEG9Y7KwPuYjizrl79RVlpKlrKm86TdoTkbElEMJQwdXzMIsDwktr4tF3J0Mf6qPN6ejUlWA== X-Google-Smtp-Source: AGHT+IH0XWmLrjrIy1MTScXBWyTyDd4fXE8BWYN5qwE0Up61xcEvXldAABU5y4SIztPovvZ4gLQ7 X-Received: by 2002:a05:6358:d3aa:b0:19f:3ee1:d1b4 with SMTP id e5c5f4694b2df-19f69d845f1mr161017155d.31.1718196839607; Wed, 12 Jun 2024 05:53:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718196839; cv=pass; d=google.com; s=arc-20160816; b=p7FjIhoVnotugvepaW4iqV44hN+nxGoRTf7hthcja/K1rjDVzT97Y/rZ01lc8nlmqk 26OlLxBjz1EiwyFZZeXKVQmNAbO0DwCBQy/IWKqNhGMbx375182sU3eL1I32v6wQ/JP4 kflNTm8MpVRJB9jnL4RcJw5/q/92O/yhy1LL3yS+FujarMfg0DAttF0Fym6ROss6NuVr ZpxJz4+Je73wUQGDi6H+o1YA40qtQQTJEGF4VekDToInIHeHRF71YnbU9zaC32b8YePq zeLFP7bmmisyVsUWRqm1tluIDZzTpjRCahDU4B38/PzdE7n+Aixz5Mrxd0ZvwCD8lOGi /kIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=v7t3TttkXANOwbhOTBniOuJ6CwP2x6L1P30MBjQfJIU=; fh=udg4O2pMKUPZntayawa2l61uFAh2mtfyA+ogEOADCU4=; b=dEkMKMVL19pWNUz3iRsdFWqo7wGCMalTL121n+vfqwv4Uh2QK8mHK+EgrmhrKj5Qw5 UyN/QqpYFcVbVAUook2UQBwcSmQAeUizByZQqnnQG4O6lbovmpMfxv7mKlDjNhsWS1xq umOKRkZwqLmAdiggibUdksSri7AQT+3AhcN0jGrOueWW1AotoAr34nYuIYic8geCBo0D Cp1G4DshithMCrcUKJKFIQutWCEfDDhywX+gMLDWIP4Ie42sO/3UabLGRvXwsc5HHZj7 ENMEaJxuKFhD9rQ1k93jixPytge6nl9K8YBXDuAb1eKpbcuqs4poe2CKVqNBRCmJtyJk fizg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="xuDmoKQ/"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-211519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6ee1e6a6492si6004521a12.590.2024.06.12.05.53.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:53:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="xuDmoKQ/"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-211519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F196285D51 for ; Wed, 12 Jun 2024 12:53:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3602A176AD4; Wed, 12 Jun 2024 12:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="xuDmoKQ/" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 9E75716F0D0; Wed, 12 Jun 2024 12:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718196775; cv=none; b=ion5NfTpRin/fU2xDg6YypcHthjlXfKYCyVG1WsT8rW3MNa7PsbOjQ4LB2LIeY7qhh6awzskmp6PXqdGA6w2O784iu06cOEt8g6zbbhgWZMfJpqJTVHS8xZ7RZbmdF3OImQqzHQIC2vo/8gdlbUGyJ4wS2ZKvLJunMS/PeOibeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718196775; c=relaxed/simple; bh=w26ka1EJKTaO+NQzaxi2BDDrZVop7CXOo67LRzv5iWc=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=HjzML9zQaIjuu6JEejV3lkDSLFK83eQjcW6ncgj9B8X+EFB20YuFkRcAKDCHIGPiqUJMJqJmJc6JK2C7Z+2WqrRVIsiJERl0V88jDIh0jE9fAkpIXRJtwmeXLAHTo/13nCl1ImXgH7tOZGifLw6g3vfwX1pTkAVrKQVhYRcUpws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=xuDmoKQ/; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 45CCqadx048161; Wed, 12 Jun 2024 07:52:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1718196756; bh=v7t3TttkXANOwbhOTBniOuJ6CwP2x6L1P30MBjQfJIU=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=xuDmoKQ/vSo4UGpn99RJyqbNwZhqs8mZNmqphtoGj5tEi5B1PRB/O8LkKxu18TMMe yqYwiKhFWMfWfXLKzompcxx1nwTQjdl70bZ7kRJ/LMzrqBw/nUm/GK+F5YTfQXHY1h QfwaG0U52LfmJ4bsYzWvz++7eozNmibYgLCRimMs= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 45CCqZvk072612 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Jun 2024 07:52:35 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 12 Jun 2024 07:52:35 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 12 Jun 2024 07:52:35 -0500 Received: from [172.24.227.57] (linux-team-01.dhcp.ti.com [172.24.227.57]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 45CCqT2S004025; Wed, 12 Jun 2024 07:52:30 -0500 Message-ID: Date: Wed, 12 Jun 2024 18:22:29 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg driver as network device To: Andrew Lunn CC: , , , , , , , , , , , , , , , , Siddharth Vadapalli , References: <20240531064006.1223417-1-y-mallik@ti.com> <20240531064006.1223417-3-y-mallik@ti.com> <4416ada7-399b-4ea0-88b0-32ca432d777b@lunn.ch> <2d65aa06-cadd-4462-b8b9-50c9127e6a30@ti.com> Content-Language: en-US From: Yojana Mallik In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On 6/4/24 18:24, Andrew Lunn wrote: >>>> + u32 buff_slot_size; >>>> + /* Base Address for Tx or Rx shared memory */ >>>> + u32 base_addr; >>>> +} __packed; >>> >>> What do you mean by address here? Virtual address, physical address, >>> DMA address? And whos address is this, you have two CPUs here, with no >>> guaranteed the shared memory is mapped to the same address in both >>> address spaces. >>> >>> Andrew >> >> The address referred above is physical address. It is the address of Tx and Rx >> buffer under the control of Linux operating over A53 core. The check if the >> shared memory is mapped to the same address in both address spaces is checked >> by the R5 core. > > u32 is too small for a physical address. I'm sure there are systems > with more than 4G of address space. Also, i would not assume both CPUs > map the memory to the same physical address. > > Andrew The shared memory address space in AM64x board is 2G and u32 data type for address works to use this address space. In order to make the driver generic,to work with systems that have more than 4G address space, we can change the base addr data type to u64 in the virtual driver code and the corresponding necessary changes have to be made in the firmware. During handshake between Linux and remote core, the remote core advertises Tx and Rx shared memory info to Linux using rpmsg framework. Linux retrieves the info related to shared memory from the response received using icve_rpmsg_cb function. + case ICVE_RESP_SHM_INFO: + /* Retrieve Tx and Rx shared memory info from msg */ + port->tx_buffer->head = + ioremap(msg->resp_msg.shm_info.shm_info_tx.base_addr, + sizeof(*port->tx_buffer->head)); + + port->tx_buffer->buf->base_addr = + ioremap((msg->resp_msg.shm_info.shm_info_tx.base_addr + + sizeof(*port->tx_buffer->head)), + (msg->resp_msg.shm_info.shm_info_tx.num_pkt_bufs * + msg->resp_msg.shm_info.shm_info_tx.buff_slot_size)); + + port->tx_buffer->tail = + ioremap(msg->resp_msg.shm_info.shm_info_tx.base_addr + + sizeof(*port->tx_buffer->head) + + (msg->resp_msg.shm_info.shm_info_tx.num_pkt_bufs * + msg->resp_msg.shm_info.shm_info_tx.buff_slot_size), + sizeof(*port->tx_buffer->tail)); + + The shared memory layout is modeled as circular buffer. /* Shared Memory Layout * * --------------------------- ***************** * | MAGIC_NUM | icve_shm_head * | HEAD | * --------------------------- ***************** * | MAGIC_NUM | * | PKT_1_LEN | * | PKT_1 | * --------------------------- * | MAGIC_NUM | * | PKT_2_LEN | icve_shm_buf * | PKT_2 | * --------------------------- * | . | * | . | * --------------------------- * | MAGIC_NUM | * | PKT_N_LEN | * | PKT_N | * --------------------------- **************** * | MAGIC_NUM | icve_shm_tail * | TAIL | * --------------------------- **************** */ Linux retrieves the following info provided in response by R5 core: Tx buffer head address which is stored in port->tx_buffer->head Tx buffer buffer's base address which is stored in port->tx_buffer->buf->base_addr Tx buffer tail address which is stored in port->tx_buffer->tail The number of packets that can be put into Tx buffer which is stored in port->icve_tx_max_buffers Rx buffer head address which is stored in port->rx_buffer->head Rx buffer buffer's base address which is stored in port->rx_buffer->buf->base_addr Rx buffer tail address which is stored in port->rx_buffer->tail The number of packets that are put into Rx buffer which is stored in port->icve_rx_max_buffers Linux trusts these addresses sent by the R5 core to send or receive ethernet packets. By this way both the CPUs map to the same physical address. Regards, Yojana Mallik