...
...
7
In anticipation of it's release, this series is an RFC.
7
In anticipation of it's release, this series is an RFC.
8
8
9
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0286_1.0.0WIP90.pdf
9
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0286_1.0.0WIP90.pdf
10
[2] https://www.dmtf.org/content/now-available-%E2%80%93-spdm-storage-binding-specification-wip
10
[2] https://www.dmtf.org/content/now-available-%E2%80%93-spdm-storage-binding-specification-wip
11
11
12
Wilfred Mallawa (4):
12
Changes V1 -> V2:
13
spdm-socket: add seperate send/recv functions
13
- Split out the SPDM Socket API patch for separate send/recv functions
14
- Addressed comments from Klaus Jensen
15
- Dropped unnecessary allocation length check
16
- Dropped unnecessary alloc_len alignment check
17
- Fixed up `nvme_security_receive: dw10` SPSP bit-masking
18
19
Wilfred Mallawa (3):
14
spdm: add spdm storage transport virtual header
20
spdm: add spdm storage transport virtual header
15
hw/nvme: add NVMe Admin Security SPDM support
21
hw/nvme: add NVMe Admin Security SPDM support
16
hw/nvme: connect SPDM over NVMe Security Send/Recv
22
hw/nvme: connect SPDM over NVMe Security Send/Recv
17
23
18
backends/spdm-socket.c | 25 ++++
19
docs/specs/spdm.rst | 10 +-
24
docs/specs/spdm.rst | 10 +-
20
hw/nvme/ctrl.c | 269 +++++++++++++++++++++++++++++++++--
25
hw/nvme/ctrl.c | 265 +++++++++++++++++++++++++++++++++--
21
hw/nvme/nvme.h | 5 +
26
hw/nvme/nvme.h | 5 +
22
include/block/nvme.h | 15 ++
27
include/block/nvme.h | 15 ++
23
include/hw/pci/pci_device.h | 1 +
28
include/hw/pci/pci_device.h | 1 +
24
include/system/spdm-socket.h | 47 ++++++
29
include/system/spdm-socket.h | 12 ++
25
7 files changed, 358 insertions(+), 14 deletions(-)
30
6 files changed, 294 insertions(+), 14 deletions(-)
26
31
27
--
32
--
28
2.47.1
33
2.48.0
diff view generated by jsdifflib
Deleted patch
1
This is to support uni-directional transports such as SPDM
2
over Storage. As specified by the DMTF DSP0286.
3
1
4
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
5
---
6
backends/spdm-socket.c | 25 +++++++++++++++++++++++++
7
include/system/spdm-socket.h | 35 +++++++++++++++++++++++++++++++++++
8
2 files changed, 60 insertions(+)
9
10
diff --git a/backends/spdm-socket.c b/backends/spdm-socket.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/backends/spdm-socket.c
13
+++ b/backends/spdm-socket.c
14
@@ -XXX,XX +XXX,XX @@ int spdm_socket_connect(uint16_t port, Error **errp)
15
return client_socket;
16
}
17
18
+uint32_t spdm_socket_receive(const int socket, uint32_t transport_type,
19
+ void *rsp, uint32_t rsp_len)
20
+{
21
+ uint32_t command;
22
+ bool result;
23
+
24
+ result = receive_platform_data(socket, transport_type, &command,
25
+ (uint8_t *)rsp, &rsp_len);
26
+
27
+ if (!result) {
28
+ return 0;
29
+ }
30
+
31
+ assert(command != 0);
32
+
33
+ return rsp_len;
34
+}
35
+
36
+bool spdm_socket_send(const int socket, uint32_t socket_cmd,
37
+ uint32_t transport_type, void *req, uint32_t req_len)
38
+{
39
+ return send_platform_data(socket, transport_type,
40
+ socket_cmd, req, req_len);
41
+}
42
+
43
uint32_t spdm_socket_rsp(const int socket, uint32_t transport_type,
44
void *req, uint32_t req_len,
45
void *rsp, uint32_t rsp_len)
46
diff --git a/include/system/spdm-socket.h b/include/system/spdm-socket.h
47
index XXXXXXX..XXXXXXX 100644
48
--- a/include/system/spdm-socket.h
49
+++ b/include/system/spdm-socket.h
50
@@ -XXX,XX +XXX,XX @@ uint32_t spdm_socket_rsp(const int socket, uint32_t transport_type,
51
void *req, uint32_t req_len,
52
void *rsp, uint32_t rsp_len);
53
54
+/**
55
+ * spdm_socket_rsp: Receive a message from an SPDM server
56
+ * @socket: socket returned from spdm_socket_connect()
57
+ * @transport_type: SPDM_SOCKET_TRANSPORT_TYPE_* macro
58
+ * @rsp: response buffer
59
+ * @rsp_len: response buffer length
60
+ *
61
+ * Receives a message from the SPDM server and returns the number of bytes
62
+ * received or 0 on failure. This can be used to receive a message from the SPDM
63
+ * server without sending anything first.
64
+ */
65
+uint32_t spdm_socket_receive(const int socket, uint32_t transport_type,
66
+ void *rsp, uint32_t rsp_len);
67
+
68
+/**
69
+ * spdm_socket_rsp: Sends a message to an SPDM server
70
+ * @socket: socket returned from spdm_socket_connect()
71
+ * @socket_cmd: socket command type (normal/if_recv/if_send etc...)
72
+ * @transport_type: SPDM_SOCKET_TRANSPORT_TYPE_* macro
73
+ * @req: request buffer
74
+ * @req_len: request buffer length
75
+ *
76
+ * Sends platform data to a SPDM server on socket, returns true on success.
77
+ * The response from the server must then be fetched by using
78
+ * spdm_socket_receive().
79
+ */
80
+bool spdm_socket_send(const int socket, uint32_t socket_cmd,
81
+ uint32_t transport_type, void *req, uint32_t req_len);
82
+
83
/**
84
* spdm_socket_close: send a shutdown command to the server
85
* @socket: socket returned from spdm_socket_connect()
86
@@ -XXX,XX +XXX,XX @@ uint32_t spdm_socket_rsp(const int socket, uint32_t transport_type,
87
void spdm_socket_close(const int socket, uint32_t transport_type);
88
89
#define SPDM_SOCKET_COMMAND_NORMAL 0x0001
90
+#define SPDM_SOCKET_STORAGE_CMD_IF_SEND 0x0002
91
+#define SPDM_SOCKET_STORAGE_CMD_IF_RECV 0x0003
92
+#define SOCKET_SPDM_STORAGE_ACK_STATUS 0x0004
93
#define SPDM_SOCKET_COMMAND_OOB_ENCAP_KEY_UPDATE 0x8001
94
#define SPDM_SOCKET_COMMAND_CONTINUE 0xFFFD
95
#define SPDM_SOCKET_COMMAND_SHUTDOWN 0xFFFE
96
@@ -XXX,XX +XXX,XX @@ void spdm_socket_close(const int socket, uint32_t transport_type);
97
98
#define SPDM_SOCKET_TRANSPORT_TYPE_MCTP 0x01
99
#define SPDM_SOCKET_TRANSPORT_TYPE_PCI_DOE 0x02
100
+#define SPDM_SOCKET_TRANSPORT_TYPE_SCSI 0x03
101
+#define SPDM_SOCKET_TRANSPORT_TYPE_NVME 0x04
102
103
#define SPDM_SOCKET_MAX_MESSAGE_BUFFER_SIZE 0x1200
104
+#define SPDM_SOCKET_MAX_MSG_STATUS_LEN 0x02
105
106
#endif
107
--
108
2.47.1
diff view generated by jsdifflib
...
...
28
+
28
+
29
#define SPDM_SOCKET_COMMAND_NORMAL 0x0001
29
#define SPDM_SOCKET_COMMAND_NORMAL 0x0001
30
#define SPDM_SOCKET_STORAGE_CMD_IF_SEND 0x0002
30
#define SPDM_SOCKET_STORAGE_CMD_IF_SEND 0x0002
31
#define SPDM_SOCKET_STORAGE_CMD_IF_RECV 0x0003
31
#define SPDM_SOCKET_STORAGE_CMD_IF_RECV 0x0003
32
--
32
--
33
2.47.1
33
2.48.0
diff view generated by jsdifflib
1
Adds the NVMe Admin Security Send/Receive command support with support
1
Adds the NVMe Admin Security Send/Receive command support with support
2
for DMTFs SPDM. The transport binding for SPDM is defined in the
2
for DMTFs SPDM. The transport binding for SPDM is defined in the
3
DMTF DSP0286.
3
DMTF DSP0286.
4
4
5
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
5
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
6
---
6
---
7
hw/nvme/ctrl.c | 207 ++++++++++++++++++++++++++++++++++++++++++-
7
hw/nvme/ctrl.c | 203 ++++++++++++++++++++++++++++++++++++++++++-
8
hw/nvme/nvme.h | 5 ++
8
hw/nvme/nvme.h | 5 ++
9
include/block/nvme.h | 15 ++++
9
include/block/nvme.h | 15 ++++
10
3 files changed, 226 insertions(+), 1 deletion(-)
10
3 files changed, 222 insertions(+), 1 deletion(-)
11
11
12
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
12
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
13
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/nvme/ctrl.c
14
--- a/hw/nvme/ctrl.c
15
+++ b/hw/nvme/ctrl.c
15
+++ b/hw/nvme/ctrl.c
...
...
168
+ }
168
+ }
169
+
169
+
170
+ ret = nvme_c2h(n, rsp_spdm_buf, MIN(recvd, alloc_len), req);
170
+ ret = nvme_c2h(n, rsp_spdm_buf, MIN(recvd, alloc_len), req);
171
+ g_free(rsp_spdm_buf);
171
+ g_free(rsp_spdm_buf);
172
+
172
+
173
+ if (alloc_len < recvd) {
174
+ return NVME_NO_COMPLETE | NVME_DNR;
175
+ }
176
+
177
+ if (ret) {
173
+ if (ret) {
178
+ return NVME_NO_COMPLETE | NVME_DNR;
174
+ return NVME_NO_COMPLETE | NVME_DNR;
179
+ }
175
+ }
180
+
176
+
181
+ return NVME_SUCCESS;
177
+ return NVME_SUCCESS;
182
+}
178
+}
183
+
179
+
184
+static uint16_t nvme_get_sec_prot_info(NvmeCtrl *n, NvmeRequest *req)
180
+static uint16_t nvme_get_sec_prot_info(NvmeCtrl *n, NvmeRequest *req)
185
+{
181
+{
186
+ uint32_t alloc_len = le32_to_cpu(req->cmd.cdw11);
182
+ uint32_t alloc_len = le32_to_cpu(req->cmd.cdw11);
187
+ uint8_t resp[12] = {0};
183
+ uint8_t resp[10] = {0};
188
+
184
+
189
+ if (alloc_len < 12) {
185
+ if (alloc_len < 10) {
190
+ return NVME_INVALID_FIELD | NVME_DNR;
186
+ return NVME_INVALID_FIELD | NVME_DNR;
191
+ }
187
+ }
192
+
188
+
193
+ /* Support Security Protol List Length */
189
+ /* Support Security Protol List Length */
194
+ resp[6] = 0; /* MSB */
190
+ resp[6] = 0; /* MSB */
...
...
202
+
198
+
203
+/* From controller to host */
199
+/* From controller to host */
204
+static uint16_t nvme_security_receive(NvmeCtrl *n, NvmeRequest *req)
200
+static uint16_t nvme_security_receive(NvmeCtrl *n, NvmeRequest *req)
205
+{
201
+{
206
+ uint32_t dw10 = le32_to_cpu(req->cmd.cdw10);
202
+ uint32_t dw10 = le32_to_cpu(req->cmd.cdw10);
207
+ uint16_t spsp = dw10 & 0xFFFF;
203
+ uint16_t spsp = (dw10 >> 8) & 0xFFFF;
208
+ uint8_t secp = (dw10 >> 24) & 0xff;
204
+ uint8_t secp = (dw10 >> 24) & 0xFF;
209
+
205
+
210
+ switch (secp) {
206
+ switch (secp) {
211
+ case SFSC_SECURITY_PROT_INFO:
207
+ case SFSC_SECURITY_PROT_INFO:
212
+ switch (spsp) {
208
+ switch (spsp) {
213
+ case 0:
209
+ case 0:
...
...
296
+
292
+
297
typedef struct QEMU_PACKED NvmeFdpConfsHdr {
293
typedef struct QEMU_PACKED NvmeFdpConfsHdr {
298
uint16_t num_confs;
294
uint16_t num_confs;
299
uint8_t version;
295
uint8_t version;
300
--
296
--
301
2.47.1
297
2.48.0
diff view generated by jsdifflib
...
...
169
+ char *spdm_trans;
169
+ char *spdm_trans;
170
170
171
/* DOE */
171
/* DOE */
172
DOECap doe_spdm;
172
DOECap doe_spdm;
173
--
173
--
174
2.47.1
174
2.48.0
diff view generated by jsdifflib