1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
From 227d9cb35658fe104ff6fde62e4a00e6d595df0d Mon Sep 17 00:00:00 2001
From: Adam Borowski <kilobyte@angband.pl>
Date: Sat, 25 Jun 2022 20:35:35 +0200
Subject: [PATCH] Drop unused queries for block size, fixing build with new
kernels
Quoting Linux commit f8669f1d6a86a6b17104ceca9340ded280307ac1:
> Block Aperture Window support was an attempt to layer an error model
> over PMEM for platforms that did not support machine-check-recovery.
> However, it was abandoned before it ever shipped, and only ever existed
> in the ACPI specification. Meanwhile Linux has carried a large pile of
> dead code for non-shipping infrastructure. [...]
We fetched block sizes but never used that info for anything. Now that
the required defines have been dropped in kernel 5.18, let's purge that
code.
Signed-off-by: Adam Borowski <adam.borowski@intel.com>
Upstream-Status: Submitted
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
src/os/linux/lnx_system.c | 56 ---------------------------------------
src/os/os.h | 2 --
src/os/win/win_system.c | 2 --
3 files changed, 60 deletions(-)
diff --git a/src/os/linux/lnx_system.c b/src/os/linux/lnx_system.c
index a2903d8b..d2ad3c1f 100644
--- a/src/os/linux/lnx_system.c
+++ b/src/os/linux/lnx_system.c
@@ -315,61 +315,6 @@ int os_get_os_type()
return OS_TYPE_LINUX;
}
-int get_supported_block_sizes(struct nvm_driver_capabilities *p_capabilities)
-{
- int rc = NVM_SUCCESS;
- int found = 0;
- struct ndctl_ctx *ctx;
-
- p_capabilities->num_block_sizes = 0;
-
- if ((rc = ndctl_new(&ctx)) >= 0)
- {
- struct ndctl_bus *bus;
- ndctl_bus_foreach(ctx, bus)
- {
- struct ndctl_region *region;
- ndctl_region_foreach(bus, region)
- {
- int nstype = ndctl_region_get_nstype(region);
- if (ndctl_region_is_enabled(region) &&
- (nstype == ND_DEVICE_NAMESPACE_BLK))
- {
- struct ndctl_namespace *namespace;
- ndctl_namespace_foreach(region, namespace)
- {
- p_capabilities->num_block_sizes =
- ndctl_namespace_get_num_sector_sizes(namespace);
-
- for (int i = 0; i < p_capabilities->num_block_sizes; i++)
- {
- p_capabilities->block_sizes[i] =
- ndctl_namespace_get_supported_sector_size(namespace, i);
- }
- found = 1;
- break;
- }
- }
- if (found)
- {
- break;
- }
- }
- if (found)
- {
- break;
- }
- }
- ndctl_unref(ctx);
- }
- else
- {
- rc = linux_err_to_nvm_lib_err(rc);
- }
-
- return rc;
-}
-
int os_get_driver_capabilities(struct nvm_driver_capabilities *p_capabilities)
{
p_capabilities->features.get_platform_capabilities = 1;
@@ -399,7 +344,6 @@ int os_get_driver_capabilities(struct nvm_driver_capabilities *p_capabilities)
p_capabilities->features.app_direct_mode = 1;
p_capabilities->min_namespace_size = ndctl_min_namespace_size();
- get_supported_block_sizes(p_capabilities);
p_capabilities->namespace_memory_page_allocation_capable = 1;
return 0;
}
diff --git a/src/os/os.h b/src/os/os.h
index 736904de..e5a08bcd 100644
--- a/src/os/os.h
+++ b/src/os/os.h
@@ -66,8 +66,6 @@ struct driver_feature_flags
struct nvm_driver_capabilities
{
- unsigned int block_sizes[MAX_NUMBER_OF_BLOCK_SIZES]; // in bytes
- unsigned int num_block_sizes;
unsigned long long min_namespace_size; // in bytes
unsigned int namespace_memory_page_allocation_capable;
struct driver_feature_flags features;
diff --git a/src/os/win/win_system.c b/src/os/win/win_system.c
index 0c18cf0e..4d840333 100644
--- a/src/os/win/win_system.c
+++ b/src/os/win/win_system.c
@@ -830,8 +830,6 @@ int os_get_driver_capabilities(struct nvm_driver_capabilities *p_capabilities)
memset(p_capabilities, 0, sizeof(struct nvm_driver_capabilities));
p_capabilities->min_namespace_size = BYTES_PER_GIB;
- p_capabilities->num_block_sizes = 1;
- p_capabilities->block_sizes[0] = 1;
p_capabilities->namespace_memory_page_allocation_capable = 0;
p_capabilities->features.get_platform_capabilities = 1;
|