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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/i86pc/i86hvm/Makefile
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# This makefile drives the production of the i86hvm platform modules.
#
# i86pc implementation architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../..
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
# Hammerhead: GNU Make target-specific syntax (was dmake :=)
def: TARGET = def
all: TARGET = all
install: TARGET = install
install_h: TARGET = install_h
clean: TARGET = clean
clobber: TARGET = clobber
check: TARGET = check
#
# Default build targets.
#
.KEEP_STATE:
.PARALLEL: $(HVM_KMODS)
def all clean clobber: $(HVM_KMODS)
install: install_implementations .WAIT \
$(HVM_KMODS)
install_implementations: \
$(ROOT_HVM_DIR) \
$(ROOT_HVM_DRV_DIR) \
$(ROOT_HVM_MISC_DIR) \
$(USR_HVM_DIR)
$(HVM_KMODS): FRC
@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
install_h check: FRC
#
# Include common targets.
#
include $(UTSBASE)/$(PLATFORM)/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Define objects
HVM_BOOTSTRAP_OBJS += hvm_bootstrap.o
PV_CMDK_OBJS += cmdk.o
PV_RTLS_OBJS += rtls.o
PV_SD_OBJS += sd.o
XDF_OBJS += xdf.o
XNF_OBJS += xnf.o
XPV_OBJS += xpv_support.o xvdi.o gnttab.o evtchn.o xenbus_comms.o \
xenbus_client.o xenbus_probe.o xenbus_xs.o
XPVD_OBJS += xpvd.o
# Include i86hvm header files
INC_PATH += -I$(UTSBASE)/common/xen -I$(UTSBASE)/i86pc/i86hvm
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2018, Joyent, Inc.
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
# Hammerhead: i86hvm modules install to unified /kernel/ (no platform split)
ROOT_HVM_DIR = $(ROOT)/kernel
ROOT_HVM_MOD_DIR = $(ROOT)/kernel
ROOT_HVM_DRV_DIR_32 = $(ROOT_HVM_MOD_DIR)/drv
ROOT_HVM_DRV_DIR_64 = $(ROOT_HVM_MOD_DIR)/drv
ROOT_HVM_DRV_DIR = $(ROOT_HVM_DRV_DIR_$(CLASS))
ROOT_HVM_MISC_DIR_32 = $(ROOT_HVM_MOD_DIR)/misc
ROOT_HVM_MISC_DIR_64 = $(ROOT_HVM_MOD_DIR)/misc
ROOT_HVM_MISC_DIR = $(ROOT_HVM_MISC_DIR_$(CLASS))
USR_HVM_DIR = $(USR_PLAT_DIR)/i86hvm
#
# Define modules.
#
HVM_DRV_KMODS= cmdk rtls xdf xnf xpv xpvd
HVM_MISC_KMODS= hvm_bootstrap
HVM_KMODS= $(HVM_DRV_KMODS) $(HVM_MISC_KMODS)
include $(UTSBASE)/i86pc/i86hvm/Makefile.files
#
# Include common rules.
#
include $(UTSBASE)/i86pc/Makefile.i86pc
#
# Indicate that we are building for the i86hvm semi-platform.
# Also use Solaris specific code in xen public header files.
#
CPPFLAGS += -DXPV_HVM_DRIVER -D_SOLARIS
ASFLAGS += -DXPV_HVM_DRIVER
# needs work
SMATCH=off
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# This Makefile defines the build rules for the directory
# uts/i86pc/i86hvm.
#
# The following two-level ordering must be maintained in this file.
# Lines are sorted first in order of decreasing specificity based on
# the first directory component. That is, i86pc rules come before
# intel rules come before common rules.
#
# Lines whose initial directory components are equal are sorted
# alphabetically by the remaining components.
#
# Section 1a: C object build rules
#
$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/i86hvm/io/xpv/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/i86hvm/io/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
$(OBJS_DIR)/%.o: $(UTSBASE)/common/xen/io/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
$(OBJS_DIR)/%.o: $(UTSBASE)/common/xen/os/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Common targets for i86hvm platform-implementation specific modules.
#
.KEEP_STATE:
#
# Rules for implementation subdirectories.
#
$(ROOT_HVM_DIR):
$(INS.dir)
$(ROOT_HVM_MOD_DIR): $(ROOT_HVM_DIR)
$(INS.dir)
$(ROOT_HVM_DRV_DIR_32): $(ROOT_HVM_MOD_DIR)
$(INS.dir)
$(ROOT_HVM_DRV_DIR_64): $(ROOT_HVM_DRV_DIR_32)
$(INS.dir)
$(ROOT_HVM_MISC_DIR_32): $(ROOT_HVM_MOD_DIR)
$(INS.dir)
$(ROOT_HVM_MISC_DIR_64): $(ROOT_HVM_MISC_DIR_32)
$(INS.dir)
$(ROOT_HVM_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_HVM_MOD_DIR) FRC
$(INS.file)
$(ROOT_HVM_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_HVM_DRV_DIR) FRC
$(INS.file)
$(ROOT_HVM_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_HVM_MISC_DIR) FRC
$(INS.file)
$(USR_HVM_DIR):
$(INS.dir)
#
# Include common targets.
#
include $(UTSBASE)/$(PLATFORM)/i86hvm/Makefile.rules
include $(UTSBASE)/$(PLATFORM)/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
UTSBASE= ../../..
MODULE= cmdk
OBJECTS= $(PV_CMDK_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE= $(ROOT_HVM_DRV_DIR)/$(MODULE)
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
ALL_TARGET= $(BINARY)
INSTALL_TARGET= $(BINARY) $(ROOTMODULE)
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/i86pc/hvm_bootstrap/Makefile
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# i86pc architecture dependent
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../../..
#
# Define the module and object file sets.
#
MODULE = hvm_bootstrap
OBJECTS = $(HVM_BOOTSTRAP_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(ROOT_HVM_MISC_DIR)/$(MODULE)
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
#
# Define targets
#
ALL_TARGET = $(BINARY)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Include common targets.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Fake cmdk module. Prevents the real cmdk driver from loading in
* a xen HVM domain so that xdf may operate instead.
*/
#include <sys/sunddi.h>
#include <sys/errno.h>
#include <sys/modctl.h>
/*ARGSUSED*/
static int
stubattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
{
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
stubdetach(dev_info_t *dip, ddi_detach_cmd_t cmd)
{
return (DDI_SUCCESS);
}
static struct dev_ops stub_ops = {
DEVO_REV,
0,
NULL,
nulldev,
nulldev,
stubattach,
stubdetach,
nodev,
NULL,
NULL,
NULL,
ddi_quiesce_not_needed
};
static struct modldrv modldrv = {
&mod_driverops,
"xVM cmdk stub",
&stub_ops
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modldrv, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_fini(void)
{
return (EBUSY);
}
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/modctl.h>
#include <sys/sunddi.h>
#include <sys/sunndi.h>
/*
* The hvm_bootstrap misc module is installed in the i86hvm platform
* directly so it will only be loaded in HVM emulated environment.
*/
/*
* hvmboot_rootconf() exists to force attach all xdf disk driver nodes
* before the pv cmdk disk driver comes along and tries to access any of
* these nodes (which usually happens when mounting the root disk device
* in an hvm environment). See the block comments at the top of pv_cmdk.c
* for more information about why this is necessary.
*
* hvmboot_rootconf() also force attaches xnf network driver nodes so
* that boot interface can be plumbed when booted via the network.
*/
int
hvmboot_rootconf()
{
dev_info_t *xpvd_dip;
major_t dev_major;
dev_major = ddi_name_to_major("xdf");
if (dev_major == (major_t)-1)
cmn_err(CE_PANIC, "unable to load xdf disk driver");
if (resolve_pathname("/xpvd", &xpvd_dip, NULL, NULL) != 0)
cmn_err(CE_PANIC, "unable to configure /xpvd nexus");
(void) ndi_devi_config_driver(xpvd_dip, 0, dev_major);
dev_major = ddi_name_to_major("xnf");
if (dev_major == (major_t)-1)
cmn_err(CE_PANIC, "unable to load xnf network driver");
(void) ndi_devi_config_driver(xpvd_dip, 0, dev_major);
ndi_rele_devi(xpvd_dip);
return (0);
}
static struct modlmisc modlmisc = {
&mod_miscops, "hvm_bootstrap misc module"
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modlmisc, NULL
};
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_init()
{
return (mod_install(&modlinkage));
}
int
_fini()
{
return (EBUSY);
}
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Fake rtls module. Prevents the real rtls driver from loading in
* a xen HVM domain so that xnf may operate instead.
*/
#include <sys/sunddi.h>
#include <sys/errno.h>
#include <sys/modctl.h>
static struct dev_ops stub_ops = {
DEVO_REV,
0,
NULL,
nulldev,
nulldev,
NULL,
NULL,
nodev,
NULL,
NULL,
NULL,
ddi_quiesce_not_needed
};
static struct modldrv modldrv = {
&mod_driverops,
"xVM rtls stub",
&stub_ops
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modldrv, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_fini(void)
{
return (EBUSY);
}
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2014 by Delphix. All rights reserved.
*/
#include <sys/types.h>
#include <sys/xpv_support.h>
#include <sys/hypervisor.h>
#include <sys/machsystm.h>
#include <sys/mutex.h>
#include <sys/cmn_err.h>
#include <sys/dditypes.h>
#include <sys/atomic.h>
#include <sys/sysmacros.h>
#include <sys/cpu.h>
#include <sys/psw.h>
#include <sys/psm.h>
#include <sys/sdt.h>
extern dev_info_t *xpv_dip;
static ddi_intr_handle_t *evtchn_ihp = NULL;
static ddi_softint_handle_t evtchn_to_handle[NR_EVENT_CHANNELS];
kmutex_t ec_lock;
static int evtchn_callback_irq = -1;
static volatile ulong_t *pending_events;
static volatile ulong_t *masked_events;
/* log2(NBBY * sizeof (ulong)) */
#define EVTCHN_SHIFT 6
/* Atomically get and clear a ulong from memory. */
#define GET_AND_CLEAR(src, targ) { \
membar_enter(); \
do { \
targ = *src; \
} while (atomic_cas_ulong(src, targ, 0) != targ); \
}
/* Get the first and last bits set in a bitmap */
#define GET_BOUNDS(bitmap, low, high) { \
int _i; \
low = high = -1; \
for (_i = 0; _i <= sizeof (ulong_t); _i++) \
if (bitmap & (1UL << _i)) { \
if (low == -1) \
low = _i; \
high = _i; \
} \
}
void
ec_bind_evtchn_to_handler(int evtchn, pri_t pri, ec_handler_fcn_t handler,
void *arg1)
{
ddi_softint_handle_t hdl;
if (evtchn < 0 || evtchn >= NR_EVENT_CHANNELS) {
cmn_err(CE_WARN, "Binding invalid event channel: %d", evtchn);
return;
}
(void) ddi_intr_add_softint(xpv_dip, &hdl, pri, handler, (caddr_t)arg1);
mutex_enter(&ec_lock);
ASSERT(evtchn_to_handle[evtchn] == NULL);
evtchn_to_handle[evtchn] = hdl;
mutex_exit(&ec_lock);
/* Let the hypervisor know we're prepared to handle this event */
hypervisor_unmask_event(evtchn);
}
void
ec_unbind_evtchn(int evtchn)
{
evtchn_close_t close;
ddi_softint_handle_t hdl;
if (evtchn < 0 || evtchn >= NR_EVENT_CHANNELS) {
cmn_err(CE_WARN, "Unbinding invalid event channel: %d", evtchn);
return;
}
/*
* Let the hypervisor know we're no longer prepared to handle this
* event
*/
hypervisor_mask_event(evtchn);
/* Cleanup the event handler metadata */
mutex_enter(&ec_lock);
hdl = evtchn_to_handle[evtchn];
evtchn_to_handle[evtchn] = NULL;
mutex_exit(&ec_lock);
close.port = evtchn;
(void) HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
(void) ddi_intr_remove_softint(hdl);
}
void
ec_notify_via_evtchn(unsigned int port)
{
evtchn_send_t send;
if ((int)port == -1)
return;
send.port = port;
(void) HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
}
void
hypervisor_unmask_event(unsigned int ev)
{
int index = ev >> EVTCHN_SHIFT;
ulong_t bit = 1UL << (ev & ((1UL << EVTCHN_SHIFT) - 1));
volatile ulong_t *maskp;
evtchn_unmask_t unmask;
/*
* index,bit contain the event number as an index into the
* masked-events bitmask. Set it to 0.
*/
maskp = &masked_events[index];
atomic_and_ulong(maskp, ~bit);
/* Let the hypervisor know the event has been unmasked */
unmask.port = ev;
if (HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask) != 0)
panic("xen_evtchn_unmask() failed");
}
/* Set a bit in an evtchan mask word */
void
hypervisor_mask_event(uint_t ev)
{
int index = ev >> EVTCHN_SHIFT;
ulong_t bit = 1UL << (ev & ((1UL << EVTCHN_SHIFT) - 1));
volatile ulong_t *maskp;
maskp = &masked_events[index];
atomic_or_ulong(maskp, bit);
}
void
hypervisor_clear_event(uint_t ev)
{
int index = ev >> EVTCHN_SHIFT;
ulong_t bit = 1UL << (ev & ((1UL << EVTCHN_SHIFT) - 1));
volatile ulong_t *maskp;
maskp = &pending_events[index];
atomic_and_ulong(maskp, ~bit);
}
int
xen_alloc_unbound_evtchn(int domid, int *evtchnp)
{
evtchn_alloc_unbound_t alloc;
int err;
alloc.dom = DOMID_SELF;
alloc.remote_dom = (domid_t)domid;
if ((err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
&alloc)) == 0) {
*evtchnp = alloc.port;
/* ensure evtchn is masked till we're ready to use it */
(void) hypervisor_mask_event(*evtchnp);
} else {
err = xen_xlate_errcode(err);
}
return (err);
}
int
xen_bind_interdomain(int domid, int remote_port, int *port)
{
evtchn_bind_interdomain_t bind;
int err;
bind.remote_dom = (domid_t)domid;
bind.remote_port = remote_port;
if ((err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
&bind)) == 0)
*port = bind.local_port;
else
err = xen_xlate_errcode(err);
return (err);
}
/*ARGSUSED*/
uint_t
evtchn_callback_fcn(caddr_t arg0, caddr_t arg1)
{
ulong_t pending_word;
int i, j, port;
volatile struct vcpu_info *vci;
uint_t rv = DDI_INTR_UNCLAIMED;
ddi_softint_handle_t hdl;
int low, high;
ulong_t sels;
/*
* Xen hard-codes all notifications to VCPU0, so we bind
* ourselves via xpv.conf. Note that this also assumes that all
* evtchns are bound to VCPU0, which is true by default.
*/
ASSERT(CPU->cpu_id == 0);
vci = &HYPERVISOR_shared_info->vcpu_info[0];
again:
DTRACE_PROBE2(evtchn__scan__start, int, vci->evtchn_upcall_pending,
ulong_t, vci->evtchn_pending_sel);
atomic_and_8(&vci->evtchn_upcall_pending, 0);
/*
* Find the upper and lower bounds in which we need to search for
* pending events.
*/
GET_AND_CLEAR(&vci->evtchn_pending_sel, sels);
/* sels == 1 is by far the most common case. Make it fast */
if (sels == 1)
low = high = 0;
else if (sels == 0)
return (rv);
else
GET_BOUNDS(sels, low, high);
/* Scan the port list, looking for words with bits set */
for (i = low; i <= high; i++) {
ulong_t tmp;
GET_AND_CLEAR(&pending_events[i], tmp);
pending_word = tmp & ~(masked_events[i]);
/* Scan the bits in the word, looking for pending events */
while (pending_word != 0) {
j = lowbit(pending_word) - 1;
port = (i << EVTCHN_SHIFT) + j;
pending_word = pending_word & ~(1UL << j);
/*
* If there is a handler registered for this event,
* schedule a softint of the appropriate priority
* to execute it.
*/
if ((hdl = evtchn_to_handle[port]) != NULL) {
(void) ddi_intr_trigger_softint(hdl, NULL);
rv = DDI_INTR_CLAIMED;
}
}
}
DTRACE_PROBE2(evtchn__scan__end, int, vci->evtchn_upcall_pending,
ulong_t, vci->evtchn_pending_sel);
if ((volatile uint8_t)vci->evtchn_upcall_pending ||
((volatile ulong_t)vci->evtchn_pending_sel))
goto again;
return (rv);
}
static int
set_hvm_callback(int irq)
{
struct xen_hvm_param xhp;
xhp.domid = DOMID_SELF;
xhp.index = HVM_PARAM_CALLBACK_IRQ;
xhp.value = irq;
return (HYPERVISOR_hvm_op(HVMOP_set_param, &xhp));
}
void
ec_fini()
{
int i;
for (i = 0; i < NR_EVENT_CHANNELS; i++)
ec_unbind_evtchn(i);
evtchn_callback_irq = -1;
if (evtchn_ihp != NULL) {
(void) ddi_intr_disable(*evtchn_ihp);
(void) ddi_intr_remove_handler(*evtchn_ihp);
(void) ddi_intr_free(*evtchn_ihp);
kmem_free(evtchn_ihp, sizeof (ddi_intr_handle_t));
evtchn_ihp = NULL;
}
}
int
ec_init(void)
{
int i;
int rv, actual;
ddi_intr_handle_t *ihp;
/*
* Translate the variable-sized pending and masked event bitmasks
* into constant-sized arrays of uint32_t's.
*/
pending_events = &HYPERVISOR_shared_info->evtchn_pending[0];
masked_events = &HYPERVISOR_shared_info->evtchn_mask[0];
/*
* Clear our event handler structures and prevent the hypervisor
* from triggering any events.
*/
mutex_init(&ec_lock, NULL, MUTEX_SPIN, (void *)ipltospl(SPL7));
for (i = 0; i < NR_EVENT_CHANNELS; i++) {
evtchn_to_handle[i] = NULL;
(void) hypervisor_mask_event(i);
}
/*
* Allocate and initialize an interrupt handler to process the
* hypervisor's "hey you have events pending!" interrupt.
*/
ihp = kmem_zalloc(sizeof (ddi_intr_handle_t), KM_SLEEP);
rv = ddi_intr_alloc(xpv_dip, ihp, DDI_INTR_TYPE_FIXED, 0, 1, &actual,
DDI_INTR_ALLOC_NORMAL);
if (rv < 0 || actual != 1) {
cmn_err(CE_WARN, "Could not allocate evtchn interrupt: %d",
rv);
return (-1);
}
rv = ddi_intr_add_handler(*ihp, evtchn_callback_fcn, NULL, NULL);
if (rv < 0) {
(void) ddi_intr_free(*ihp);
cmn_err(CE_WARN, "Could not attach evtchn handler");
return (-1);
}
evtchn_ihp = ihp;
if (ddi_intr_enable(*ihp) != DDI_SUCCESS) {
cmn_err(CE_WARN, "Could not enable evtchn interrupts\n");
return (-1);
}
/* Tell the hypervisor which interrupt we're waiting on. */
evtchn_callback_irq = ((ddi_intr_handle_impl_t *)*ihp)->ih_vector;
if (set_hvm_callback(evtchn_callback_irq) != 0) {
cmn_err(CE_WARN, "Couldn't register evtchn callback");
return (-1);
}
return (0);
}
void
ec_resume(void)
{
int i;
/* New event-channel space is not 'live' yet. */
for (i = 0; i < NR_EVENT_CHANNELS; i++)
(void) hypervisor_mask_event(i);
if (set_hvm_callback(evtchn_callback_irq) != 0)
cmn_err(CE_WARN, "Couldn't register evtchn callback");
}
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
interrupt-priorities=9;
#
# Xen requires us to run this ISR on VCPU0, since that's where all HVM
# event channels are bound to, and only the vcpu_info for VCPU0 gets
# updated. This will bind us to VCPU0, as well as preventing any
# attempt to offline the CPU.
#
xpv_intpt_bind_cpus=0;
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/modctl.h>
#include <sys/types.h>
#include <sys/archsystm.h>
#include <sys/machsystm.h>
#include <sys/sunndi.h>
#include <sys/sunddi.h>
#include <sys/ddi_subrdefs.h>
#include <sys/xpv_support.h>
#include <sys/xen_errno.h>
#include <sys/hypervisor.h>
#include <sys/gnttab.h>
#include <sys/xenbus_comms.h>
#include <sys/xenbus_impl.h>
#include <xen/sys/xendev.h>
#include <sys/sysmacros.h>
#include <sys/x86_archext.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/conf.h>
#include <sys/devops.h>
#include <sys/pc_mmu.h>
#include <sys/cmn_err.h>
#include <sys/cpr.h>
#include <sys/ddi.h>
#include <vm/seg_kmem.h>
#include <vm/as.h>
#include <vm/hat_pte.h>
#include <vm/hat_i86.h>
#define XPV_MINOR 0
#define XPV_BUFSIZE 128
/* virtual addr for the store_mfn page */
caddr_t xb_addr;
dev_info_t *xpv_dip;
static dev_info_t *xpvd_dip;
#ifdef DEBUG
int xen_suspend_debug;
#define SUSPEND_DEBUG if (xen_suspend_debug) xen_printf
#else
#define SUSPEND_DEBUG(...)
#endif
/*
* Forward declarations
*/
static int xpv_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
static int xpv_attach(dev_info_t *, ddi_attach_cmd_t);
static int xpv_detach(dev_info_t *, ddi_detach_cmd_t);
static int xpv_open(dev_t *, int, int, cred_t *);
static int xpv_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);
static struct cb_ops xpv_cb_ops = {
xpv_open,
nulldev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
xpv_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op,
NULL,
D_MP,
CB_REV,
NULL,
NULL
};
static struct dev_ops xpv_dv_ops = {
DEVO_REV,
0,
xpv_getinfo,
nulldev, /* identify */
nulldev, /* probe */
xpv_attach,
xpv_detach,
nodev, /* reset */
&xpv_cb_ops,
NULL, /* struct bus_ops */
NULL, /* power */
ddi_quiesce_not_supported, /* devo_quiesce */
};
static struct modldrv modldrv = {
&mod_driverops,
"xpv driver",
&xpv_dv_ops
};
static struct modlinkage modl = {
MODREV_1,
{
(void *)&modldrv,
NULL /* null termination */
}
};
static ddi_dma_attr_t xpv_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffffffffffULL, /* highest usable address */
0x7fffffff, /* maximum DMAable byte count */
MMU_PAGESIZE, /* alignment in bytes */
0x7ff, /* bitmap of burst sizes */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0x7fffffffULL, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
static ddi_device_acc_attr_t xpv_accattr = {
DDI_DEVICE_ATTR_V0,
DDI_NEVERSWAP_ACC,
DDI_STRICTORDER_ACC
};
#define MAX_ALLOCATIONS 10
static ddi_dma_handle_t xpv_dma_handle[MAX_ALLOCATIONS];
static ddi_acc_handle_t xpv_dma_acchandle[MAX_ALLOCATIONS];
static int xen_alloc_cnt = 0;
void *
xen_alloc_pages(pgcnt_t cnt)
{
size_t len;
int a = xen_alloc_cnt++;
caddr_t addr;
ASSERT(xen_alloc_cnt < MAX_ALLOCATIONS);
if (ddi_dma_alloc_handle(xpv_dip, &xpv_dma_attr, DDI_DMA_SLEEP, 0,
&xpv_dma_handle[a]) != DDI_SUCCESS)
return (NULL);
if (ddi_dma_mem_alloc(xpv_dma_handle[a], MMU_PAGESIZE * cnt,
&xpv_accattr, DDI_DMA_CONSISTENT, DDI_DMA_SLEEP, 0,
&addr, &len, &xpv_dma_acchandle[a]) != DDI_SUCCESS) {
ddi_dma_free_handle(&xpv_dma_handle[a]);
cmn_err(CE_WARN, "Couldn't allocate memory for xpv devices");
return (NULL);
}
return (addr);
}
/*
* This function is invoked twice, first time with reprogram=0 to set up
* the xpvd portion of the device tree. The second time it is ignored.
*/
static void
xpv_enumerate(int reprogram)
{
dev_info_t *dip;
if (reprogram != 0)
return;
ndi_devi_alloc_sleep(ddi_root_node(), "xpvd",
(pnode_t)DEVI_SID_NODEID, &dip);
(void) ndi_devi_bind_driver(dip, 0);
/*
* Too early to enumerate split device drivers in domU
* since we need to create taskq thread during enumeration.
* So, we only enumerate softdevs and console here.
*/
xendev_enum_all(dip, B_TRUE);
}
/*
* Translate a hypervisor errcode to a Solaris error code.
*/
int
xen_xlate_errcode(int error)
{
#define CASE(num) case X_##num: error = num; break
switch (-error) {
CASE(EPERM); CASE(ENOENT); CASE(ESRCH);
CASE(EINTR); CASE(EIO); CASE(ENXIO);
CASE(E2BIG); CASE(ENOMEM); CASE(EACCES);
CASE(EFAULT); CASE(EBUSY); CASE(EEXIST);
CASE(ENODEV); CASE(EISDIR); CASE(EINVAL);
CASE(ENOSPC); CASE(ESPIPE); CASE(EROFS);
CASE(ENOSYS); CASE(ENOTEMPTY); CASE(EISCONN);
CASE(ENODATA);
default:
panic("xen_xlate_errcode: unknown error %d", error);
}
return (error);
#undef CASE
}
/*PRINTFLIKE1*/
void
xen_printf(const char *fmt, ...)
{
va_list adx;
va_start(adx, fmt);
printf(fmt, adx);
va_end(adx);
}
/*
* Stub functions to get the FE drivers to build, and to catch drivers that
* misbehave in HVM domains.
*/
/*ARGSUSED*/
void
xen_release_pfn(pfn_t pfn)
{
panic("xen_release_pfn() is not supported in HVM domains");
}
/*ARGSUSED*/
void
reassign_pfn(pfn_t pfn, mfn_t mfn)
{
panic("reassign_pfn() is not supported in HVM domains");
}
/*ARGSUSED*/
long
balloon_free_pages(uint_t page_cnt, mfn_t *mfns, caddr_t kva, pfn_t *pfns)
{
panic("balloon_free_pages() is not supported in HVM domains");
return (0);
}
/*ARGSUSED*/
void
balloon_drv_added(int64_t delta)
{
panic("balloon_drv_added() is not supported in HVM domains");
}
/*
* Add a mapping for the machine page at the given virtual address.
*/
void
kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level)
{
ASSERT(level == 0);
hat_devload(kas.a_hat, (caddr_t)va, MMU_PAGESIZE,
mmu_btop(ma), PROT_READ | PROT_WRITE, HAT_LOAD);
}
/*ARGSUSED*/
int
xen_map_gref(uint_t cmd, gnttab_map_grant_ref_t *mapop, uint_t count,
boolean_t uvaddr)
{
long rc;
ASSERT(cmd == GNTTABOP_map_grant_ref);
rc = HYPERVISOR_grant_table_op(cmd, mapop, count);
return (rc);
}
static struct xenbus_watch shutdown_watch;
taskq_t *xen_shutdown_tq;
#define SHUTDOWN_INVALID -1
#define SHUTDOWN_POWEROFF 0
#define SHUTDOWN_REBOOT 1
#define SHUTDOWN_SUSPEND 2
#define SHUTDOWN_HALT 3
#define SHUTDOWN_MAX 4
#define SHUTDOWN_TIMEOUT_SECS (60 * 5)
int
xen_suspend_devices(dev_info_t *dip)
{
int error;
char buf[XPV_BUFSIZE];
SUSPEND_DEBUG("xen_suspend_devices\n");
for (; dip != NULL; dip = ddi_get_next_sibling(dip)) {
if (xen_suspend_devices(ddi_get_child(dip)))
return (ENXIO);
if (ddi_get_driver(dip) == NULL)
continue;
SUSPEND_DEBUG("Suspending device %s\n", ddi_deviname(dip, buf));
ASSERT((DEVI(dip)->devi_cpr_flags & DCF_CPR_SUSPENDED) == 0);
if (!i_ddi_devi_attached(dip)) {
error = DDI_FAILURE;
} else {
error = devi_detach(dip, DDI_SUSPEND);
}
if (error == DDI_SUCCESS) {
DEVI(dip)->devi_cpr_flags |= DCF_CPR_SUSPENDED;
} else {
SUSPEND_DEBUG("WARNING: Unable to suspend device %s\n",
ddi_deviname(dip, buf));
cmn_err(CE_WARN, "Unable to suspend device %s.",
ddi_deviname(dip, buf));
cmn_err(CE_WARN, "Device is busy or does not "
"support suspend/resume.");
return (ENXIO);
}
}
return (0);
}
int
xen_resume_devices(dev_info_t *start, int resume_failed)
{
dev_info_t *dip, *next, *last = NULL;
int did_suspend;
int error = resume_failed;
char buf[XPV_BUFSIZE];
SUSPEND_DEBUG("xen_resume_devices\n");
while (last != start) {
dip = start;
next = ddi_get_next_sibling(dip);
while (next != last) {
dip = next;
next = ddi_get_next_sibling(dip);
}
/*
* cpr is the only one that uses this field and the device
* itself hasn't resumed yet, there is no need to use a
* lock, even though kernel threads are active by now.
*/
did_suspend = DEVI(dip)->devi_cpr_flags & DCF_CPR_SUSPENDED;
if (did_suspend)
DEVI(dip)->devi_cpr_flags &= ~DCF_CPR_SUSPENDED;
/*
* There may be background attaches happening on devices
* that were not originally suspended by cpr, so resume
* only devices that were suspended by cpr. Also, stop
* resuming after the first resume failure, but traverse
* the entire tree to clear the suspend flag.
*/
if (did_suspend && !error) {
SUSPEND_DEBUG("Resuming device %s\n",
ddi_deviname(dip, buf));
/*
* If a device suspended by cpr gets detached during
* the resume process (for example, due to hotplugging)
* before cpr gets around to issuing it a DDI_RESUME,
* we'll have problems.
*/
if (!i_ddi_devi_attached(dip)) {
cmn_err(CE_WARN, "Skipping %s, device "
"not ready for resume",
ddi_deviname(dip, buf));
} else {
if (devi_attach(dip, DDI_RESUME) !=
DDI_SUCCESS) {
error = ENXIO;
}
}
}
if (error == ENXIO) {
cmn_err(CE_WARN, "Unable to resume device %s",
ddi_deviname(dip, buf));
}
error = xen_resume_devices(ddi_get_child(dip), error);
last = dip;
}
return (error);
}
/*ARGSUSED*/
static int
check_xpvd(dev_info_t *dip, void *arg)
{
char *name;
name = ddi_node_name(dip);
if (name == NULL || strcmp(name, "xpvd")) {
return (DDI_WALK_CONTINUE);
} else {
xpvd_dip = dip;
return (DDI_WALK_TERMINATE);
}
}
/*
* Top level routine to direct suspend/resume of a domain.
*/
void
xen_suspend_domain(void)
{
extern void rtcsync(void);
extern void ec_resume(void);
extern kmutex_t ec_lock;
struct xen_add_to_physmap xatp;
ulong_t flags;
int err;
cmn_err(CE_NOTE, "Domain suspending for save/migrate");
SUSPEND_DEBUG("xen_suspend_domain\n");
/*
* We only want to suspend the PV devices, since the emulated devices
* are suspended by saving the emulated device state. The PV devices
* are all children of the xpvd nexus device. So we search the
* device tree for the xpvd node to use as the root of the tree to
* be suspended.
*/
if (xpvd_dip == NULL)
ddi_walk_devs(ddi_root_node(), check_xpvd, NULL);
/*
* suspend interrupts and devices
*/
if (xpvd_dip != NULL)
(void) xen_suspend_devices(ddi_get_child(xpvd_dip));
else
cmn_err(CE_WARN, "No PV devices found to suspend");
SUSPEND_DEBUG("xenbus_suspend\n");
xenbus_suspend();
mutex_enter(&cpu_lock);
/*
* Suspend on vcpu 0
*/
thread_affinity_set(curthread, 0);
kpreempt_disable();
if (ncpus > 1)
pause_cpus(NULL, NULL);
/*
* We can grab the ec_lock as it's a spinlock with a high SPL. Hence
* any holder would have dropped it to get through pause_cpus().
*/
mutex_enter(&ec_lock);
/*
* From here on in, we can't take locks.
*/
flags = intr_clear();
SUSPEND_DEBUG("HYPERVISOR_suspend\n");
/*
* At this point we suspend and sometime later resume.
* Note that this call may return with an indication of a cancelled
* for now no matter ehat the return we do a full resume of all
* suspended drivers, etc.
*/
(void) HYPERVISOR_shutdown(SHUTDOWN_suspend);
/*
* Point HYPERVISOR_shared_info to the proper place.
*/
xatp.domid = DOMID_SELF;
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
xatp.gpfn = xen_shared_info_frame;
if ((err = HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) != 0)
panic("Could not set shared_info page. error: %d", err);
SUSPEND_DEBUG("gnttab_resume\n");
gnttab_resume();
SUSPEND_DEBUG("ec_resume\n");
ec_resume();
intr_restore(flags);
if (ncpus > 1)
start_cpus();
mutex_exit(&ec_lock);
mutex_exit(&cpu_lock);
/*
* Now we can take locks again.
*/
rtcsync();
SUSPEND_DEBUG("xenbus_resume\n");
xenbus_resume();
SUSPEND_DEBUG("xen_resume_devices\n");
if (xpvd_dip != NULL)
(void) xen_resume_devices(ddi_get_child(xpvd_dip), 0);
thread_affinity_clear(curthread);
kpreempt_enable();
SUSPEND_DEBUG("finished xen_suspend_domain\n");
cmn_err(CE_NOTE, "domain restore/migrate completed");
}
static void
xen_dirty_shutdown(void *arg)
{
int cmd = (uintptr_t)arg;
cmn_err(CE_WARN, "Externally requested shutdown failed or "
"timed out.\nShutting down.\n");
switch (cmd) {
case SHUTDOWN_HALT:
case SHUTDOWN_POWEROFF:
(void) kadmin(A_SHUTDOWN, AD_POWEROFF, NULL, kcred);
break;
case SHUTDOWN_REBOOT:
(void) kadmin(A_REBOOT, AD_BOOT, NULL, kcred);
break;
}
}
static void
xen_shutdown(void *arg)
{
int cmd = (uintptr_t)arg;
proc_t *initpp;
ASSERT(cmd > SHUTDOWN_INVALID && cmd < SHUTDOWN_MAX);
if (cmd == SHUTDOWN_SUSPEND) {
xen_suspend_domain();
return;
}
switch (cmd) {
case SHUTDOWN_POWEROFF:
force_shutdown_method = AD_POWEROFF;
break;
case SHUTDOWN_HALT:
force_shutdown_method = AD_HALT;
break;
case SHUTDOWN_REBOOT:
force_shutdown_method = AD_BOOT;
break;
}
/*
* If we're still booting and init(1) isn't set up yet, simply halt.
*/
mutex_enter(&pidlock);
initpp = prfind(P_INITPID);
mutex_exit(&pidlock);
if (initpp == NULL) {
extern void halt(char *);
halt("Power off the System"); /* just in case */
}
/*
* else, graceful shutdown with inittab and all getting involved
*/
psignal(initpp, SIGPWR);
(void) timeout(xen_dirty_shutdown, arg,
SHUTDOWN_TIMEOUT_SECS * drv_usectohz(MICROSEC));
}
/*ARGSUSED*/
static void
xen_shutdown_handler(struct xenbus_watch *watch, const char **vec,
unsigned int len)
{
char *str;
xenbus_transaction_t xbt;
int err, shutdown_code = SHUTDOWN_INVALID;
unsigned int slen;
again:
err = xenbus_transaction_start(&xbt);
if (err)
return;
if (xenbus_read(xbt, "control", "shutdown", (void *)&str, &slen)) {
(void) xenbus_transaction_end(xbt, 1);
return;
}
SUSPEND_DEBUG("%d: xen_shutdown_handler: \"%s\"\n", CPU->cpu_id, str);
/*
* If this is a watch fired from our write below, check out early to
* avoid an infinite loop.
*/
if (strcmp(str, "") == 0) {
(void) xenbus_transaction_end(xbt, 0);
kmem_free(str, slen);
return;
} else if (strcmp(str, "poweroff") == 0) {
shutdown_code = SHUTDOWN_POWEROFF;
} else if (strcmp(str, "reboot") == 0) {
shutdown_code = SHUTDOWN_REBOOT;
} else if (strcmp(str, "suspend") == 0) {
shutdown_code = SHUTDOWN_SUSPEND;
} else if (strcmp(str, "halt") == 0) {
shutdown_code = SHUTDOWN_HALT;
} else {
printf("Ignoring shutdown request: %s\n", str);
}
(void) xenbus_write(xbt, "control", "shutdown", "");
err = xenbus_transaction_end(xbt, 0);
if (err == EAGAIN) {
SUSPEND_DEBUG("%d: trying again\n", CPU->cpu_id);
kmem_free(str, slen);
goto again;
}
kmem_free(str, slen);
if (shutdown_code != SHUTDOWN_INVALID) {
(void) taskq_dispatch(xen_shutdown_tq, xen_shutdown,
(void *)(intptr_t)shutdown_code, 0);
}
}
static int
xpv_drv_init(void)
{
if (xpv_feature(XPVF_HYPERCALLS) < 0 ||
xpv_feature(XPVF_SHARED_INFO) < 0)
return (-1);
/* Set up the grant tables. */
gnttab_init();
/* Set up event channel support */
if (ec_init() != 0)
return (-1);
/* Set up xenbus */
xb_addr = vmem_alloc(heap_arena, MMU_PAGESIZE, VM_SLEEP);
xs_early_init();
xs_domu_init();
/* Set up for suspend/resume/migrate */
xen_shutdown_tq = taskq_create("shutdown_taskq", 1,
maxclsyspri - 1, 1, 1, TASKQ_PREPOPULATE);
shutdown_watch.node = "control/shutdown";
shutdown_watch.callback = xen_shutdown_handler;
if (register_xenbus_watch(&shutdown_watch))
cmn_err(CE_WARN, "Failed to set shutdown watcher");
return (0);
}
static void
xen_pv_fini()
{
ec_fini();
}
/*ARGSUSED*/
static int
xpv_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **result)
{
if (getminor((dev_t)arg) != XPV_MINOR)
return (DDI_FAILURE);
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = xpv_dip;
break;
case DDI_INFO_DEVT2INSTANCE:
*result = 0;
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
xpv_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
{
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
if (ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
ddi_get_instance(dip), DDI_PSEUDO, 0) != DDI_SUCCESS)
return (DDI_FAILURE);
xpv_dip = dip;
if (xpv_drv_init() != 0)
return (DDI_FAILURE);
ddi_report_dev(dip);
/*
* If the memscrubber attempts to scrub the pages we hand to Xen,
* the domain will panic.
*/
memscrub_disable();
/* Report our version to dom0 */
(void) xenbus_printf(XBT_NULL, "guest/xpv", "version", "%d",
HVMPV_XPV_VERS);
return (DDI_SUCCESS);
}
/*
* Attempts to reload the PV driver plumbing hang on Intel platforms, so
* we don't want to unload the framework by accident.
*/
int xpv_allow_detach = 0;
static int
xpv_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
{
if (cmd != DDI_DETACH || xpv_allow_detach == 0)
return (DDI_FAILURE);
if (xpv_dip != NULL) {
xen_pv_fini();
ddi_remove_minor_node(dip, NULL);
xpv_dip = NULL;
}
return (DDI_SUCCESS);
}
/*ARGSUSED1*/
static int
xpv_open(dev_t *dev, int flag, int otyp, cred_t *cr)
{
return (getminor(*dev) == XPV_MINOR ? 0 : ENXIO);
}
/*ARGSUSED*/
static int
xpv_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cr,
int *rval_p)
{
return (EINVAL);
}
int
_init(void)
{
int err;
if ((err = mod_install(&modl)) != 0)
return (err);
impl_bus_add_probe(xpv_enumerate);
return (0);
}
int
_fini(void)
{
int err;
if ((err = mod_remove(&modl)) != 0)
return (err);
impl_bus_delete_probe(xpv_enumerate);
return (0);
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modl, modinfop));
}
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
UTSBASE= ../../..
MODULE= rtls
OBJECTS= $(PV_RTLS_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE= $(ROOT_HVM_DRV_DIR)/$(MODULE)
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
ALL_TARGET= $(BINARY)
INSTALL_TARGET= $(BINARY) $(ROOTMODULE)
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/i86pc/xdf/Makefile
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# i86pc architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../../..
#
# Define the module and object file sets.
#
MODULE = xdf
OBJECTS = $(XDF_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(ROOT_HVM_DRV_DIR)/$(MODULE)
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
#
# Define targets
#
ALL_TARGET = $(BINARY)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
# Overrides
CPPFLAGS += -DHVMPV_XDF_VERS=2
LDFLAGS += -Nmisc/cmlb -Ndrv/xpvd -Ndrv/xpv
CERRWARN += -Wno-parentheses
CERRWARN += -Wno-switch
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Include common targets.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/i86pc/xnf/Makefile
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# This makefile drives the production of the xve
# network driver kernel module.
#
# i86pc architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../../..
#
# Define the module and object file sets.
#
MODULE = xnf
OBJECTS = $(XNF_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(ROOT_HVM_DRV_DIR)/$(MODULE)
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
#
# Define targets
#
ALL_TARGET = $(BINARY)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
#
# Driver depends on MAC & IP
#
CPPFLAGS += -DHVMPV_XNF_VERS=1
LDFLAGS += -Nmisc/mac -Ndrv/ip -Ndrv/xpvd -Ndrv/xpv
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Include common targets.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# uts/i86pc/xpv/Makefile
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
#
# This makefile drives the production of the xpv
# driver, which provides the necessary infrastructure for
# paravirtualized front-end drivers in HVM systems.
#
# i86pc implementation architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../../..
#
# Define the module and object file sets.
#
MODULE = xpv
OBJECTS = $(XPV_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(ROOT_HVM_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/i86pc/i86hvm/io/xpv
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
#
# Define targets
#
ALL_TARGET = $(BINARY) $(CONFMOD)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
CPPFLAGS += -DHVMPV_XPV_VERS=1
LDFLAGS += -N mach/pcplusmp
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Include common targets.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
#
# This makefile drives the production of the xpvd nexus driver
#
# i86pc implementation architecture dependent
#
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
#
UTSBASE = ../../..
#
# Define the module and object file sets.
#
MODULE = xpvd
OBJECTS = $(XPVD_OBJS:%=$(OBJS_DIR)/%)
ROOTMODULE = $(ROOT_HVM_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/xen/io
#
# Include common rules.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.i86hvm
#
# Define targets
#
ALL_TARGET = $(BINARY) $(CONFMOD)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
CPPFLAGS += -DHVMPV_XPVD_VERS=1
LDFLAGS += -Ndrv/xpv
CERRWARN += $(CNOWARN_UNINIT)
#
# Default build targets.
#
.KEEP_STATE:
def: $(DEF_DEPS)
all: $(ALL_DEPS)
clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
install: $(INSTALL_DEPS)
#
# Include common targets.
#
include $(UTSBASE)/i86pc/i86hvm/Makefile.targ
|