Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp330914pxu; Wed, 14 Oct 2020 02:28:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAMVMQhIEej9O/TkCMLjdgD6VJjHAK5SMmPTNbG30g77qiK174Ol6jt7/LGiZINVMp2+ID X-Received: by 2002:a50:fe98:: with SMTP id d24mr4116635edt.223.1602667690030; Wed, 14 Oct 2020 02:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602667690; cv=none; d=google.com; s=arc-20160816; b=0hre/qtq62mHQzHbZyt/627AmFsy9z0sDq9okvQ7X1isTlelljGY/VmRmWn8FgwcL6 uV/NsS6BQuL2jDC4PoRx40oXlkk5N38u021JODYM++K8aEm2JdvYhmyQ1PP10AP8kteF KtRkMsUnriu3g/wOfkX+bah9MIssWjRelZZWcDYOQYrKto/AtDw5QrVIQnBMd3AV3qRt ZkJTCO5vNL2BgGnxAv/1qDSDIswSZOQcJpgrHNugkRiM0N86FdbRwGKyq9wn6EPZTeBR evPkHIAW3WoXXtUnD/RD+DaUTo2RPGc7rxxujr+R2CNZ4mbdgCjVeS+Ab1o9LZEltrJL UA4w== 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=8/cb+6ARRrtk4RL3ZhsFEbwLitpFe1pF2QiRThqv3kw=; b=tdEr4b2BuPxIkjZxLqFuPOwFQb+dAbVPUDwW8qn3qfI4w0IFQaOKZrABZSMsGim2/L B5xLxuQp0hwNPS6AjZUxaE4OVPE8PSdvradt2yZmVTZzh3MWdiC55FYskpY3KiCw81yN TGd73wz3psfZ5bIEhZjTHHtqeG7YbJHuQnsD+XHmOSfyFFWUxHcRrvEx4KeygtWBYqgp /pmx+bjJ1CNz4zRZKTO/Fti6lkcg935+Zvru+9YDHqvk8X0clDUDvrNa7Pf3Dl9Hrb5m oo2Ma3YpNIZEwhJJLaNnJsmZDh4DQaBWj2Aa9VGAWFvRgptQU4j9GGnE6edi2sUdfP2C u2gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IeACXLI7; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si1838607ejq.58.2020.10.14.02.27.47; Wed, 14 Oct 2020 02:28:10 -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=@linaro.org header.s=google header.b=IeACXLI7; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730114AbgJNJYF (ORCPT + 99 others); Wed, 14 Oct 2020 05:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731174AbgJNJV4 (ORCPT ); Wed, 14 Oct 2020 05:21:56 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9611C08EA76 for ; Tue, 13 Oct 2020 16:25:26 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id o9so743419plx.10 for ; Tue, 13 Oct 2020 16:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/cb+6ARRrtk4RL3ZhsFEbwLitpFe1pF2QiRThqv3kw=; b=IeACXLI7uhaPptvACX6Id5vnuh+CAEhdvMt7+P7W9TjeZ5kX0Gi8GoTZSrhGou7nYC duZz0tWcEtKSw9psophtkb4V5wjSUd1452vMLio+QHf69EkNCkLC2ch/7Yr6NmHV58TY k7kWdKR06T6MdT9MfH70Ces9UTvCAhcAMGTAXyZxxiCwCjTsogN8OjVKblXGTUpVWbe1 OWoFu1TP71fgWXqtZvPjkAsBoHarIApwCoXSAT/2u+earSUenYfVdUVwqWRU2wujDjkN qlwQwdQfRV1HLa0uMe21rbg8F9urJuyN2S9lz4Md/Lb8E7ReyxS7nSFAI1Vv6sdeKYah 8/HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/cb+6ARRrtk4RL3ZhsFEbwLitpFe1pF2QiRThqv3kw=; b=H5h7gEuRFIleC9dz9dt5v8jhEnDm9ou/k34ybNyfJA12SmaZACjKB+R0v8CwlI+dZV g3AJdMfpaRDM4docxhdYMD0FkzKcheIGwf8WB3rTJHUL4m41fUfkVtK/dfshunpF1hfo fouNCD5/wTUAfnI/bZBU+XD5a7kgy6yNQqBsr7gAGICXT0s35coHNlJBrLc2n247b82k w2CaX2lzymNSyeXNVENsqxjuZPZnjjwAFqoXAbUT9S7nVl+nLaHPiWKQ8jERHvhWVDeg 5FEPPPiVGdrOQlA1LtmqW9iTmvNl9Hc+XQYO1DijRHXS///EFd9e1zhUfz0Y96C/eSb7 Ccnw== X-Gm-Message-State: AOAM533O6kBDpqXrY2oQrs9trVdH48OSnk3JYZFy43ImBflMYwvSVNme MAvNBVhh6/Jyw+u54FocJmQckQ== X-Received: by 2002:a17:90a:c285:: with SMTP id f5mr700469pjt.87.1602631526242; Tue, 13 Oct 2020 16:25:26 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b8sm791871pfr.159.2020.10.13.16.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 16:25:25 -0700 (PDT) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: guennadi.liakhovetski@linux.intel.com, arnaud.pouliquen@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/9] rpmsg: Move rpmsg_hr and rpmsg_ns_msg to header file Date: Tue, 13 Oct 2020 17:25:14 -0600 Message-Id: <20201013232519.1367542-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013232519.1367542-1-mathieu.poirier@linaro.org> References: <20201013232519.1367542-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move structures rpmsg_hdr and rpmsg_ns_msg to their own header file so that they can be used by other entities. Signed-off-by: Mathieu Poirier --- drivers/rpmsg/virtio_rpmsg_bus.c | 58 ++---------------------------- include/linux/rpmsg_ns.h | 62 ++++++++++++++++++++++++++++++++ include/uapi/linux/rpmsg.h | 3 ++ 3 files changed, 67 insertions(+), 56 deletions(-) create mode 100644 include/linux/rpmsg_ns.h diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 793fe924671f..85f2acc4ed9f 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,6 +27,7 @@ #include #include #include +#include #include "rpmsg_internal.h" @@ -70,58 +71,6 @@ struct virtproc_info { struct rpmsg_endpoint *ns_ept; }; -/* The feature bitmap for virtio rpmsg */ -#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ - -/** - * struct rpmsg_hdr - common header for all rpmsg messages - * @src: source address - * @dst: destination address - * @reserved: reserved for future use - * @len: length of payload (in bytes) - * @flags: message flags - * @data: @len bytes of message payload data - * - * Every message sent(/received) on the rpmsg bus begins with this header. - */ -struct rpmsg_hdr { - __rpmsg32 src; - __rpmsg32 dst; - __rpmsg32 reserved; - __rpmsg16 len; - __rpmsg16 flags; - u8 data[]; -} __packed; - -/** - * struct rpmsg_ns_msg - dynamic name service announcement message - * @name: name of remote service that is published - * @addr: address of remote service that is published - * @flags: indicates whether service is created or destroyed - * - * This message is sent across to publish a new service, or announce - * about its removal. When we receive these messages, an appropriate - * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe() - * or ->remove() handler of the appropriate rpmsg driver will be invoked - * (if/as-soon-as one is registered). - */ -struct rpmsg_ns_msg { - char name[RPMSG_NAME_SIZE]; - __rpmsg32 addr; - __rpmsg32 flags; -} __packed; - -/** - * enum rpmsg_ns_flags - dynamic name service announcement flags - * - * @RPMSG_NS_CREATE: a new remote service was just created - * @RPMSG_NS_DESTROY: a known remote service was just destroyed - */ -enum rpmsg_ns_flags { - RPMSG_NS_CREATE = 0, - RPMSG_NS_DESTROY = 1, -}; - /** * @vrp: the remote processor this channel belongs to */ @@ -162,9 +111,6 @@ struct virtio_rpmsg_channel { */ #define RPMSG_RESERVED_ADDRESSES (1024) -/* Address 53 is reserved for advertising remote services */ -#define RPMSG_NS_ADDR (53) - static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept); static int virtio_rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len); static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, diff --git a/include/linux/rpmsg_ns.h b/include/linux/rpmsg_ns.h new file mode 100644 index 000000000000..3d836b8580b2 --- /dev/null +++ b/include/linux/rpmsg_ns.h @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_RPMSG_NS_H +#define _LINUX_RPMSG_NS_H + +#include +#include +#include + +/** + * struct rpmsg_hdr - common header for all rpmsg messages + * @src: source address + * @dst: destination address + * @reserved: reserved for future use + * @len: length of payload (in bytes) + * @flags: message flags + * @data: @len bytes of message payload data + * + * Every message sent(/received) on the rpmsg bus begins with this header. + */ +struct rpmsg_hdr { + __rpmsg32 src; + __rpmsg32 dst; + __rpmsg32 reserved; + __rpmsg16 len; + __rpmsg16 flags; + u8 data[]; +} __packed; + +/** + * struct rpmsg_ns_msg - dynamic name service announcement message + * @name: name of remote service that is published + * @addr: address of remote service that is published + * @flags: indicates whether service is created or destroyed + * + * This message is sent across to publish a new service, or announce + * about its removal. When we receive these messages, an appropriate + * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe() + * or ->remove() handler of the appropriate rpmsg driver will be invoked + * (if/as-soon-as one is registered). + */ +struct rpmsg_ns_msg { + char name[RPMSG_NAME_SIZE]; + __rpmsg32 addr; + __rpmsg32 flags; +} __packed; + +/** + * enum rpmsg_ns_flags - dynamic name service announcement flags + * + * @RPMSG_NS_CREATE: a new remote service was just created + * @RPMSG_NS_DESTROY: a known remote service was just destroyed + */ +enum rpmsg_ns_flags { + RPMSG_NS_CREATE = 0, + RPMSG_NS_DESTROY = 1, +}; + +/* Address 53 is reserved for advertising remote services */ +#define RPMSG_NS_ADDR (53) + +#endif diff --git a/include/uapi/linux/rpmsg.h b/include/uapi/linux/rpmsg.h index e14c6dab4223..d669c04ef289 100644 --- a/include/uapi/linux/rpmsg.h +++ b/include/uapi/linux/rpmsg.h @@ -24,4 +24,7 @@ struct rpmsg_endpoint_info { #define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info) #define RPMSG_DESTROY_EPT_IOCTL _IO(0xb5, 0x2) +/* The feature bitmap for virtio rpmsg */ +#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ + #endif -- 2.25.1