@@ -82,6 +82,15 @@ static const std::string icx_iio_stack_names[6] = {
82
82
" IIO Stack 5 - CBDMA/DMI "
83
83
};
84
84
85
+ static const std::string icx_d_iio_stack_names[6 ] = {
86
+ " IIO Stack 0 - MCP " ,
87
+ " IIO Stack 1 - PCIe0 " ,
88
+ " IIO Stack 2 - CBDMA/DMI " ,
89
+ " IIO Stack 3 - PCIe2 " ,
90
+ " IIO Stack 4 - PCIe3 " ,
91
+ " IIO Stack 5 - PCIe1 "
92
+ };
93
+
85
94
static const std::string snr_iio_stack_names[5 ] = {
86
95
" IIO Stack 0 - QAT " ,
87
96
" IIO Stack 1 - CBDMA/DMI " ,
@@ -111,6 +120,15 @@ static const std::map<int, int> icx_sad_to_pmu_id_mapping = {
111
120
{ 5 , 4 }
112
121
};
113
122
123
+ static const std::map<int , int > icx_d_sad_to_pmu_id_mapping = {
124
+ { ICX_CBDMA_DMI_SAD_ID, 2 },
125
+ { 1 , 5 },
126
+ { 2 , 1 },
127
+ { ICX_MCP_SAD_ID, 0 },
128
+ { 4 , 3 },
129
+ { 5 , 4 }
130
+ };
131
+
114
132
#define SNR_ACCELERATOR_PART_ID 4
115
133
116
134
#define SNR_ROOT_PORT_A_DID 0x334A
@@ -545,8 +563,16 @@ bool IPlatformMapping10Nm::getSadIdRootBusMap(uint32_t socket_id, std::map<uint8
545
563
// Mapping for IceLake Server.
546
564
class WhitleyPlatformMapping : public IPlatformMapping10Nm {
547
565
private:
566
+ const bool icx_d;
567
+ const std::map<int , int >& sad_to_pmu_id_mapping;
568
+ const std::string * iio_stack_names;
548
569
public:
549
- WhitleyPlatformMapping () = default ;
570
+ WhitleyPlatformMapping () :
571
+ icx_d (PCM::getInstance()->getCPUModelFromCPUID () == PCM::ICX_D),
572
+ sad_to_pmu_id_mapping(icx_d ? icx_d_sad_to_pmu_id_mapping : icx_sad_to_pmu_id_mapping),
573
+ iio_stack_names(icx_d ? icx_d_iio_stack_names : icx_iio_stack_names)
574
+ {
575
+ }
550
576
~WhitleyPlatformMapping () = default ;
551
577
bool pciTreeDiscover (std::vector<struct iio_stacks_on_socket >& iios, uint32_t sockets_count) override ;
552
578
};
@@ -563,15 +589,15 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
563
589
564
590
{
565
591
struct iio_stack stack;
566
- stack.iio_unit_id = icx_sad_to_pmu_id_mapping .at (ICX_MCP_SAD_ID);
567
- stack.stack_name = icx_iio_stack_names [stack.iio_unit_id ];
592
+ stack.iio_unit_id = sad_to_pmu_id_mapping .at (ICX_MCP_SAD_ID);
593
+ stack.stack_name = iio_stack_names [stack.iio_unit_id ];
568
594
iio_on_socket.stacks .push_back (stack);
569
595
}
570
596
571
597
for (auto sad_id_bus_pair = sad_id_bus_map.cbegin (); sad_id_bus_pair != sad_id_bus_map.cend (); ++sad_id_bus_pair) {
572
598
int sad_id = sad_id_bus_pair->first ;
573
- if (icx_sad_to_pmu_id_mapping .find (sad_id) ==
574
- icx_sad_to_pmu_id_mapping .end ()) {
599
+ if (sad_to_pmu_id_mapping .find (sad_id) ==
600
+ sad_to_pmu_id_mapping .end ()) {
575
601
cerr << " Unknown SAD ID: " << sad_id << endl;
576
602
return false ;
577
603
}
@@ -584,9 +610,9 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
584
610
int root_bus = sad_id_bus_pair->second ;
585
611
if (sad_id == ICX_CBDMA_DMI_SAD_ID) {
586
612
// There is one DMA Controller on each socket
587
- stack.iio_unit_id = icx_sad_to_pmu_id_mapping .at (sad_id);
613
+ stack.iio_unit_id = sad_to_pmu_id_mapping .at (sad_id);
588
614
stack.busno = root_bus;
589
- stack.stack_name = icx_iio_stack_names [stack.iio_unit_id ];
615
+ stack.stack_name = iio_stack_names [stack.iio_unit_id ];
590
616
591
617
// PCH is on socket 0 only
592
618
if (socket == 0 ) {
@@ -629,8 +655,8 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
629
655
continue ;
630
656
}
631
657
stack.busno = root_bus;
632
- stack.iio_unit_id = icx_sad_to_pmu_id_mapping .at (sad_id);
633
- stack.stack_name = icx_iio_stack_names [stack.iio_unit_id ];
658
+ stack.iio_unit_id = sad_to_pmu_id_mapping .at (sad_id);
659
+ stack.stack_name = iio_stack_names [stack.iio_unit_id ];
634
660
for (int slot = 2 ; slot < 6 ; slot++) {
635
661
struct pci pci;
636
662
pci.bdf .busno = root_bus;
@@ -1009,7 +1035,7 @@ result_content get_IIO_Samples(PCM *m, const std::vector<struct iio_stacks_on_so
1009
1035
uint64 rawEvents[4 ] = {0 };
1010
1036
std::unique_ptr<ccr> pccr (get_ccr (m, ctr.ccr ));
1011
1037
rawEvents[ctr.idx ] = pccr->get_ccr_value ();
1012
- int stacks_count = (int )iios[ 0 ]. stacks . size ();
1038
+ const int stacks_count = (int )m-> getMaxNumOfIIOStacks ();
1013
1039
before = new IIOCounterState[iios.size () * stacks_count];
1014
1040
after = new IIOCounterState[iios.size () * stacks_count];
1015
1041
0 commit comments