android_kernel_xiaomi_sm8350/net/neuron/protocol/prot_block.h
Chris Lew 6493564fe3 net: Add Neuron Framework
Neuron is a device-sharing framework which is used by guests of the
haven hypervisor to serve or access shared I/O devices and other
inter-VM services.

There are three main layers that make up a neuron service.
channel - the physical layer transport that uses the hypervisor
          provided transports.

protocol - defines the syntax and semantics to virtualize a specific
           device across VMs. Block and Net are examples of protocols.

application - integrates the neuron service components into the rest of
              the system. There would be front and back end application
              drivers for the net protocol.

Change-Id: Ic7278fdaee1cd30147e91e1126643bce79c05e52
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-03-30 21:44:24 -07:00

47 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
#ifndef __H_PROT_BLOCK_COMMON_H
#define __H_PROT_BLOCK_COMMON_H
/* Block Server Advertisement message */
struct neuron_block_advertise {
u32 logical_block_size;
u32 physical_block_size;
u64 num_device_sectors;
u32 flags;
u32 discard_granularity;
u64 discard_max_hw_sectors;
u64 discard_max_sectors;
u16 alignment_offset;
bool wc_flag;
bool fua_flag;
u8 uuid[16];
u8 label[];
} __packed;
/* Request message */
struct neuron_block_req {
u32 req_id;
u16 req_type;
u16 flags;
u64 start_sector;
u32 sectors;
} __packed;
/* Response message */
struct neuron_block_resp {
u32 resp_id;
u16 resp_status;
} __packed;
/* Bit position definition for flags field in struct neuron_block_req */
enum neuron_block_param_flags_bit {
NEURON_BLOCK_PARAM_FLAG_READONLY = 0,
NEURON_BLOCK_PARAM_FLAG_DISCARD_ZEROES,
};
#define NEURON_BLOCK_READONLY BIT(NEURON_BLOCK_PARAM_FLAG_READONLY)
#define NEURON_BLOCK_DISCARD_ZEROES BIT(NEURON_BLOCK_PARAM_FLAG_DISCARD_ZEROES)
#endif