Browse Source

Implement new --force-dev-init option to force bitstream upload to modminer and x6500 devices

Luke Dashjr 13 years ago
parent
commit
44818d8aea
5 changed files with 18 additions and 0 deletions
  1. 1 0
      README
  2. 5 0
      driver-modminer.c
  3. 5 0
      driver-x6500.c
  4. 6 0
      miner.c
  5. 1 0
      miner.h

+ 1 - 0
README

@@ -139,6 +139,7 @@ Options for both config file and command line:
 --debuglog          Enable debug logging
 --debuglog          Enable debug logging
 --expiry|-E <arg>   Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
 --expiry|-E <arg>   Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
 --failover-only     Don't leak work to backup pools when primary pool is lagging
 --failover-only     Don't leak work to backup pools when primary pool is lagging
+--force-dev-init    Always initialize devices when possible (such as bitstream uploads to some FPGAs)
 --kernel-path|-K <arg> Specify a path to where bitstream and kernel files are (default: "/usr/local/bin")
 --kernel-path|-K <arg> Specify a path to where bitstream and kernel files are (default: "/usr/local/bin")
 --load-balance      Change multipool strategy from failover to efficiency based balance
 --load-balance      Change multipool strategy from failover to efficiency based balance
 --log|-l <arg>      Interval in seconds between log output (default: 5)
 --log|-l <arg>      Interval in seconds between log output (default: 5)

+ 5 - 0
driver-modminer.c

@@ -377,6 +377,11 @@ modminer_fpga_init(struct thr_info *thr)
 		applog(LOG_ERR, "%s %u.%u: FPGA not programmed", modminer->api->name, modminer->device_id, fpgaid);
 		applog(LOG_ERR, "%s %u.%u: FPGA not programmed", modminer->api->name, modminer->device_id, fpgaid);
 		if (!modminer_fpga_upload_bitstream(modminer))
 		if (!modminer_fpga_upload_bitstream(modminer))
 			return false;
 			return false;
+	} else if (opt_force_dev_init && modminer->status == LIFE_INIT) {
+		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed, but --force-dev-init is set",
+		       modminer->api->name, modminer->device_id, fpgaid);
+		if (!modminer_fpga_upload_bitstream(modminer))
+			return false;
 	}
 	}
 	else
 	else
 		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed :)", modminer->api->name, modminer->device_id, fpgaid);
 		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed :)", modminer->api->name, modminer->device_id, fpgaid);

+ 5 - 0
driver-x6500.c

@@ -368,6 +368,11 @@ static bool x6500_fpga_init(struct thr_info *thr)
 		       x6500->api->name, x6500->device_id, fpgaid);
 		       x6500->api->name, x6500->device_id, fpgaid);
 		if (!x6500_fpga_upload_bitstream(x6500, jp))
 		if (!x6500_fpga_upload_bitstream(x6500, jp))
 			return false;
 			return false;
+	} else if (opt_force_dev_init && x6500->status == LIFE_INIT) {
+		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed, but --force-dev-init is set",
+		       x6500->api->name, x6500->device_id, fpgaid);
+		if (!x6500_fpga_upload_bitstream(x6500, jp))
+			return false;
 	} else
 	} else
 		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed :)",
 		applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed :)",
 		       x6500->api->name, x6500->device_id, fpgaid);
 		       x6500->api->name, x6500->device_id, fpgaid);

+ 6 - 0
miner.c

@@ -140,6 +140,7 @@ bool opt_restart = true;
 static bool opt_nogpu;
 static bool opt_nogpu;
 
 
 struct list_head scan_devices;
 struct list_head scan_devices;
+bool opt_force_dev_init;
 static signed int devices_enabled;
 static signed int devices_enabled;
 static bool opt_removedisabled;
 static bool opt_removedisabled;
 int total_devices;
 int total_devices;
@@ -1037,6 +1038,11 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITHOUT_ARG("--failover-only",
 	OPT_WITHOUT_ARG("--failover-only",
 			opt_set_bool, &opt_fail_only,
 			opt_set_bool, &opt_fail_only,
 			"Don't leak work to backup pools when primary pool is lagging"),
 			"Don't leak work to backup pools when primary pool is lagging"),
+#ifdef USE_FPGA
+	OPT_WITHOUT_ARG("--force-dev-init",
+	        opt_set_bool, &opt_force_dev_init,
+	        "Always initialize devices when possible (such as bitstream uploads to some FPGAs)"),
+#endif
 #ifdef HAVE_OPENCL
 #ifdef HAVE_OPENCL
 	OPT_WITH_ARG("--gpu-dyninterval",
 	OPT_WITH_ARG("--gpu-dyninterval",
 		     set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval,
 		     set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval,

+ 1 - 0
miner.h

@@ -733,6 +733,7 @@ extern void add_pool_details(bool live, char *url, char *user, char *pass);
 #endif
 #endif
 
 
 extern struct list_head scan_devices;
 extern struct list_head scan_devices;
+extern bool opt_force_dev_init;
 extern int nDevs;
 extern int nDevs;
 extern int opt_n_threads;
 extern int opt_n_threads;
 extern int num_processors;
 extern int num_processors;